table of content slugification differs from anchors slugification
See original GitHub issue🐛 Bug Report
If a header is called, for example, Tips & Tricks, the table of content section would slugify that as Tips-amp-tricks whereas the actual hash from the header is tips-tricks
This is more problematic than a mismatching anchor. Docusaurus uses scrollSpy, which fails to find the anchor like so:
This exception then blocks lots of other functionalities on the page (e.g. code tab switching)
Have you read the [Contributing Guidelines on issues]
Yeah
To Reproduce
(Write your steps here:)
- Write any markdown doc, add a header 
# Tips & Tricks - Check console
 
The problem comes from these lines: https://github.com/facebook/docusaurus/blob/6670c53d1838750de66ea2e6876da90d906428cb/packages/docusaurus-1.x/lib/core/toc.js#L40 https://github.com/facebook/docusaurus/blob/6670c53d1838750de66ea2e6876da90d906428cb/packages/docusaurus-1.x/lib/core/anchors.js#L25
If you console.log(rendered) in the first snippet, the sanitization turns Tips & Tricks into Tips & Tricks. Whereas if you console.log(textToken.content) in the latter snippet, it’s still Tips & Tricks.
cc @JoelMarcey
Issue Analytics
- State:
 - Created 4 years ago
 - Comments:5 (3 by maintainers)
 

Top Related StackOverflow Question
Hmm @chenglou are you using the latest Docusaurus v1?
@chenglou @yangshun This issue was fixed with https://github.com/facebook/docusaurus/pull/2019