Skip to content

h2 titile with ## 1. What We Mean by “Spring” report #1-what-we-mean-by-spring' is not a valid selector #1075

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

Closed
1 task
degbug opened this issue Mar 15, 2020 · 5 comments

Comments

@degbug
Copy link

degbug commented Mar 15, 2020

Bug Report

h2 titile with ## 1. What We Mean by “Spring” report #1-what-we-mean-by-spring' is not a valid selector

Steps to reproduce

h2 titile with ## 1. What We Mean by “Spring” report '#1-what-we-mean-by-spring' is not a valid selector

What is current behaviour

this is the error:
image

What is the expected behaviour

the title start with number can work well
or how can configure to make is well.
thx!

Other relevant information

  • Bug does still occur when all/other plugins are disabled?

  • Your OS: macos catalina

  • Node.js version: v12.16.1

  • npm/yarn version: 6.13.4

  • Browser version: chrome 80

  • Docsify version: 4.11.2

  • Docsify plugins:

@anikethsaha
Copy link
Member

generally, h2 tags should be linkable meaning that when clicked it should navigate towards it.
having spaces in links never works correctly as when it goes to the header, it gets converted to escaped char.
So maximum markdown renderer adds a hyphen instead of space which stops the behavior and brings consistency.
This is the same behavior with github as well.

@degbug
Copy link
Author

degbug commented Mar 15, 2020

@anikethsaha
thank you for your reply, maybe I not understand your explain. I know docsify adds a hyphen instead of space, but
the problem is the text start with number, when I use document.querySelector('#1-what"), it report
#1-what is not a valid selector。
the selector should not start with number, should start with a letter。

@anikethsaha
Copy link
Member

github does the same

https://github.com/anikethsaha/vsc-material-theme/tree/md-exp#1-override-theme-colors

We cant change the behavior , it will break other docs

@degbug
Copy link
Author

degbug commented Mar 16, 2020

@anikethsaha
but I fall back to v4.10.2, it's ok.

for example, the h2 tag with text 1. first para, the generated id is _1-first-para in version 4.10.2.
but at v4.11.2 the generated id changed to 1-first-para. the underline was removed.

if you mean, in order to make it same as github, you change the behavior in v4.11.2 ?

@anikethsaha
Copy link
Member

Yes having _ in front is not right.... It was changed intentionally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants