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

Some minor parsing issues for GitHub markdown #92

Open
EdmundKorley opened this issue Jan 23, 2016 · 4 comments
Open

Some minor parsing issues for GitHub markdown #92

EdmundKorley opened this issue Jan 23, 2016 · 4 comments
Labels

Comments

@EdmundKorley
Copy link

When parsing: a header named

this identifier

(Note the code formating) doctoc yields:

#this-identifier

... when it should yield:

#-this-identifier

This is because, -this-identifier, rather than this-identifier, is the actual id that GitHub renders when it converts the markdown to HTML for display. As a result the generated doctoc link will not work as a relative link.

There are a few other examples of this like:

For

Header & noise

doctoc produces

#header-&-noise

which will lead to a dead link in GitHub markdown rather than the appropriate

#header-noise

@rm-hull
Copy link

rm-hull commented Feb 18, 2016

For the #header-&-noise case, I think the result should be a double dash: #header--noise

@jez
Copy link
Collaborator

jez commented May 30, 2016

The # this identifier example currently works correctly on GitHub.

The # Header & noise example is indeed a bug though.

The fix is almost identical to thlorenz/anchor-markdown-header#29.

@jez jez self-assigned this May 30, 2016
@jez jez added the bug label May 30, 2016
@richbodo
Copy link

richbodo commented Mar 7, 2018

For the #header-&-noise case, the result should be a single dash: #header-noise.

Tested on github and gitlab - the link generated ignored the ampersand entirely, and uses a single hyphen.

@karfau
Copy link

karfau commented Mar 7, 2018

I would guess that it converts all special chars to - and merges multiple sequenced - into a single one.
But maybe it is possible to look at the code behind this to be sure?

@jez jez removed their assignment Apr 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants