Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

table of content slugification differs from anchors slugification #2341

Closed
chenglou opened this issue Feb 28, 2020 · 5 comments
Closed

table of content slugification differs from anchors slugification #2341

chenglou opened this issue Feb 28, 2020 · 5 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. help wanted Asking for outside help and/or contributions to this particular issue or PR. v1 This issue is for Docusaurus 1

Comments

@chenglou
Copy link
Contributor

馃悰 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:
Screen Shot 2020-02-27 at 16 34 17
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:)

  1. Write any markdown doc, add a header # Tips & Tricks
  2. Check console

The problem comes from these lines:

const rendered = md.renderInline(rawContent);

const anchor = toSlug(textToken.content, slugger);

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

@chenglou chenglou added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Feb 28, 2020
@lex111 lex111 added the v1 This issue is for Docusaurus 1 label Feb 28, 2020
@JoelMarcey
Copy link
Contributor

@chenglou Your website is still on v1 of Docusaurus, right?

cc @yangshun

@yangshun yangshun added difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. help wanted Asking for outside help and/or contributions to this particular issue or PR. and removed status: needs triage This issue has not been triaged by maintainers labels Feb 29, 2020
@yangshun
Copy link
Contributor

Yes this is v1.

@theosherry
Copy link

@chenglou @yangshun This issue was fixed with #2019

@yangshun
Copy link
Contributor

yangshun commented Mar 6, 2020

Hmm @chenglou are you using the latest Docusaurus v1?

@slorber
Copy link
Collaborator

slorber commented Jun 10, 2021

The Docusaurus team is actively working on Docusaurus v2.

After a very long alpha, Docusaurus v2 is now in beta.
We believe that the v2 beta is already better than v1, and v2 is ready for maintstream adoption.

Apart from critical issues and security fixes, we don't plan to invest much time on Docusaurus v1 anymore.

We are all closing v1 issues.
Maybe the current issue is already fixed in Docusaurus v2.
Please try to upgrade, and if the issue is still there on Docusaurus v2, open a new issue.

@slorber slorber closed this as completed Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. help wanted Asking for outside help and/or contributions to this particular issue or PR. v1 This issue is for Docusaurus 1
Projects
None yet
Development

No branches or pull requests

6 participants