You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've found that links to headers that work when working from within Jupyter Notebook/Lab no longer work when on a page built from the same notebook with MyST-NB.
(I originally opened a discussion [https://github.com/orgs/executablebooks/discussions/930] but this honestly feels more like a bug in MyST-NB, happy to be proven wrong :)!)
Details
So let's say you have this bit of Markdown in a notebook. Note that the link is #My-Title, it's cased as the header it's pointing too. This works, from your open notebook you can click on the link and gets redirected to the linked header.
[A description](#My-Title)# My Title
However, the link as defined above does not work when that notebook is built with MyST-NB and turned into HTML. Apparently MyST-Parser auto-generates header anchors and the docs say:
So in the simple case above, the difference seems to be in how the slug is cased. If the link would be written as [A description](#my-title), so all lower-cased, then that link would work on the website. But it would no longer work in Jupyter Notebook/Lab 🙃
Is there any way we could write these links so that they work in both context?
MyST-Parser docs suggest that to change the slug generation function, set myst_heading_slug_func in your conf.py to a function that accepts a string and returns a string.
Shouldn't MyST-NB specialize this function so that it respects the Jupyter spec for these links?
The text was updated successfully, but these errors were encountered:
TL;TR
We've found that links to headers that work when working from within Jupyter Notebook/Lab no longer work when on a page built from the same notebook with MyST-NB.
(I originally opened a discussion [https://github.com/orgs/executablebooks/discussions/930] but this honestly feels more like a bug in MyST-NB, happy to be proven wrong :)!)
Details
So let's say you have this bit of Markdown in a notebook. Note that the link is
#My-Title
, it's cased as the header it's pointing too. This works, from your open notebook you can click on the link and gets redirected to the linked header.However, the link as defined above does not work when that notebook is built with MyST-NB and turned into HTML. Apparently MyST-Parser auto-generates header anchors and the docs say:
So in the simple case above, the difference seems to be in how the slug is cased. If the link would be written as
[A description](#my-title)
, so all lower-cased, then that link would work on the website. But it would no longer work in Jupyter Notebook/Lab 🙃Is there any way we could write these links so that they work in both context?
MyST-Parser docs suggest that to change the slug generation function, set
myst_heading_slug_func
in yourconf.py
to a function that accepts a string and returns a string.Shouldn't MyST-NB specialize this function so that it respects the Jupyter spec for these links?
The text was updated successfully, but these errors were encountered: