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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect anchor link including an underscore character #1307

Closed
ybiquitous opened this issue Mar 25, 2019 · 3 comments
Closed

Incorrect anchor link including an underscore character #1307

ybiquitous opened this issue Mar 25, 2019 · 3 comments
Assignees
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@ybiquitous
Copy link
Contributor

πŸ› Bug Report

When an underscore character (_) is included in an anchor link, Docusaurus converts the underscore to a hyphen (e.g. #foo_bar β†’ #foo-bar).

This behavior is different from GitHub's one, so it's very confusing. πŸ˜“

Have you read the Contributing Guidelines on issues?

Yes. πŸ‘

To Reproduce

  1. Run git clone https://github.com/ybiquitous/docusaurus-sandbox on your terminal.
  2. Run cd docusaurus-sandbox/website.
  3. Run yarn install.
  4. Run yarn run start.
  5. Open http://localhost:3001/docs/doc1 page on your browser.
  6. Click foo_bar link on the page.

Expected behavior

Jump to the #foo_bar section.

Actual Behavior

Not Jump to the #foo_bar section.

Image from Gyazo

Reproducible Demo

https://github.com/ybiquitous/docusaurus-sandbox

Environment:

  • Node 10.15.3
  • Yarn 1.15.2
  • Docusaurus 1.7.3
@ybiquitous
Copy link
Contributor Author

Here is a GitHub's behavior:

Image from Gyazo

I hope Docusaurus would behave as same. πŸ™

@endiliey
Copy link
Contributor

What a tricky bug !

I made some test of headings https://gist.github.com/endiliey/f5256045e80c1c10436c6bdfce9c5961
Seems that it replaces all special characters except _ to -
Docusaurus only replaces all special characters to -

@endiliey endiliey added the bug An error in the Docusaurus core causing instability or issues with its execution label Mar 25, 2019
@endiliey endiliey self-assigned this Mar 25, 2019
@ybiquitous
Copy link
Contributor Author

Thank you so much for the quick fix! πŸ˜‚

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
Projects
None yet
Development

No branches or pull requests

2 participants