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

header ID generated are not compatible with ID generated on Github #320

Closed
veggiemonk opened this issue Dec 30, 2016 · 6 comments
Closed
Assignees

Comments

@veggiemonk
Copy link

Hi,

This is a great project!

For instance, on a README.md hosted on Github:
# Title Example --> <h1 id="title-example">Title Example</h1>

Same file but converted with Showdown:
# Title Example --> <h1 id="titleexample">Title Example</h1>

A dash - replace the space on github but showdow just erase it.
Is there an option for that?
Otherwise we cannot be consistent with url when referring to a header.

Thanks a lot

@tivie
Copy link
Member

tivie commented Dec 30, 2016

@veggiemonk thanks!
I will be adding an option for this soon (replacing spaces with dashes).

@veggiemonk
Copy link
Author

@tivie check #321 :D

@tivie
Copy link
Member

tivie commented Dec 30, 2016

I did

@tivie
Copy link
Member

tivie commented Dec 30, 2016

latest version should address this and more.

We're replacing spaces with dashes and removing the following characters: ][&~$!@#*()=:/,;?+'.%\

Can you check if these characters are enough or if there are more that github replaces?

@tivie tivie closed this as completed Dec 30, 2016
@tivie
Copy link
Member

tivie commented Dec 30, 2016

I've grabbed the replaced chars from github's redcarpet. https://github.com/vmg/redcarpet/blob/v3.4.0/ext/redcarpet/html.c#L276

Added < and > so this should cover every character github removes from header ids.

The improved version is available from commit d499feb onward

@veggiemonk
Copy link
Author

@tivie great job, thanks a lot!

tivie added a commit that referenced this issue Nov 15, 2022
# Conflicts:
#	src/subParsers/makehtml/heading.js
#	test/functional/makehtml/cases/features/#320.github-compatible-generated-header-id.html
#	test/functional/makehtml/cases/features/#320.github-compatible-generated-header-id.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants