Skip to content

slugify section headers #173

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

Merged
merged 1 commit into from
Oct 21, 2016
Merged

Conversation

HParker
Copy link
Contributor

@HParker HParker commented Oct 21, 2016

The current section headers are url encoded. Because of that they
have some funny characters like %20. We can clean that up by removing
all of the non-word characters before placing them in the anchor.

I originally planned to use /\s/g as the regex to preserve other url encoded characters like ‰ or ¥ that might be useful, but I double checked what Github does on gists and it looks like they strip everything.

hi ‰ there

becomes #hi--there in the url.

mdbook urls will now match that style.

fixes #168

The current section headers are url encoded.  Because of that they
have some funny characters like %20.  We can clean that up by removing
all of the non-word characters before placing them in the anchor.
@azerupi azerupi merged commit ecae442 into rust-lang:master Oct 21, 2016
@azerupi
Copy link
Contributor

azerupi commented Oct 21, 2016

Looks good! Thanks you :)

@HParker HParker deleted the slugify-section-anchors branch October 21, 2016 21:02
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

Successfully merging this pull request may close these issues.

Slugify section anchors
2 participants