code-hike / codehike

Marvellous code walkthroughs
https://codehike.org
MIT License
4.39k stars 135 forks source link

CH.Scrollycoding code section always stick to top #359

Closed donghhan closed 1 year ago

donghhan commented 1 year ago

Here is the link that you can refer to timestampmodel. This is just one of my example posts that I wrote.

If you go to "TimeStampModel", code section does not follow as I scroll the bar down. Is there any issues on here?

Here's my code as mdx

### `TimeStampModel`

`TimeStampModel` is abstract model that controls time.
Let's edit `models.py` file inside of `common/` app folder.

<CH.Scrollycoding>

#### Creating model class

I created class named `TimeStampModel` that controls over time of data has been created/updated.

// code-snipets
---

#### `Meta` class configuration

[`Meta` class](https://docs.djangoproject.com/en/4.1/topics/db/models/#meta-options) allows us to do several configurations for our models.
As our `TimeStampModel` is abstract base model, I set `abstract = True` as explained in [documentation](https://docs.djangoproject.com/en/4.1/topics/db/models/#abstract-base-classes).

By doing this, we can use these fields in other models without creating DB table.

// code-snipepts

---

#### `DateTimeField`

Finally, let's specify model field.

As you can literally tell from its name, [`DateTimeField`](https://docs.djangoproject.com/en/4.1/ref/models/fields/#django.db.models.DateTimeField)
controls date and time.
I created model field called `created_at` and `updated_at` for created time and updated time, respectively.

// code-snippets

---

</CH.Scrollycoding>
pomber commented 1 year ago

That's nextra right? There was an issue since nextra@2.2.13: https://github.com/code-hike/codehike/issues/322

It was fixed on nextra side 2 days ago. Can you check with the latest version of Nextra?

github-actions[bot] commented 1 year ago

:rocket: Issue was released in v0.8.3 :rocket: