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
{{ message }}
Repository navigation
Markdown Header Anchor Links do not work on page load #2399
Each markdown header has a targeted anchor link which corresponds to a URL.
i.e. http:///docs/mobile/doc1#header1
If you click on the headers in the right sidebar when the documentation is loaded, the page scrolls to the header that is the anchor link target as expected.
But, if you copy a link to one of the headers with a anchor # in it, and paste it into a new tab, the page does not scroll to the appropriate header on page load.
In dev mode, we do not use SSR, so this issue occurs. I do not think this is a serious bug, since there is no such thing in the production build. This may not be very comfortable, although it is unlikely that you will often use anchors links in dev mode 🤷♂️.
Reacted by Carlos Filoteo, Tony Sloane, Amanda Folson, Aman Sharma and Aaryan Porwal
I see the same bug for builds with "@docusaurus/core": "2.0.0-beta.4"
Edit:
Anchor links are working in both dev and prod mode once I moved all official @docusaurus/* packages to the exact same version as per the output warning. The anchor link must also be lowercase, despite VsCode accepting any case when moving between markdown files. CC @Mauriceac
Activity
lex111 commentedon Mar 11, 2020
Is there a similar bug on the builded website? This should be relevant only in development mode.
Noah-Silvera commentedon Mar 11, 2020
No there is no similar bug in prod. It only affects development mode.
lex111 commentedon Mar 11, 2020
In dev mode, we do not use SSR, so this issue occurs. I do not think this is a serious bug, since there is no such thing in the production build. This may not be very comfortable, although it is unlikely that you will often use anchors links in dev mode 🤷♂️.
Noah-Silvera commentedon Mar 11, 2020
Should we just close this issue then? Seems very minor if it only affects dev mode.
Might be worth documenting under https://v2.docusaurus.io/docs/markdown-features#markdown-headers?
Mauriceac commentedon Apr 29, 2021
I have this bug even after building.
Any workaround (other than refreshing, which effectively works)?
jsphstls commentedon Aug 24, 2021
I see the same bug for builds with"@docusaurus/core": "2.0.0-beta.4"Edit:
Anchor links are working in both dev and prod mode once I moved all official @docusaurus/* packages to the exact same version as per the output warning. The anchor link must also be lowercase, despite VsCode accepting any case when moving between markdown files. CC @Mauriceac
jsphstls commentedon Aug 24, 2021
I found a cross-page anchor link that is working on the current Docusaurus site. See the “multi-instance plugins” link under https://docusaurus.io/docs/blog#multiple-blogs.
k8w commentedon Nov 28, 2021
Still have this problem, latest version
Mauriceac commentedon Nov 29, 2021
@k8w, me too. You might want to follow issue 3081. It explains the problem, although no solution has been given yet.