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

Escape special characters in Markdown anchors #460

Merged
merged 1 commit into from
Oct 17, 2021

Conversation

derlin
Copy link
Contributor

@derlin derlin commented Oct 13, 2021

Using the full name (with dots and slashes) in markdown anchors may be problematic in some rendering engines. For example, BitBucket won't accept this kind of anchors (with special characters), making the inner links and navigation broken.

Since the template defines its own anchors (with a tags), changing the inner links format has no impact on e.g. GitHub or Gitlab.

This commit adds a new sprig filter, anchor, and ensures it is used throughout the markdown template.
The filter first replaces all / with _, then all remaining special characters with -.

It has been tested both using the examples in this repo and other, more complex examples. It has been proven not to impact the result on GitHub in any way, and the navigation now works on BitBucket as well.

This could be a minor release (not sure if I have to add the label myself or not).

see #457

Replace all special characters in markdown anchors
with `-` (and `/` with `_`) so that they work everywhere
(e.g. BitBucket).

see pseudomuto#457
@derlin
Copy link
Contributor Author

derlin commented Oct 13, 2021

@pseudomuto , @sunfmin : as per the contributing guide, here is a little ping :)

@pseudomuto
Copy link
Owner

Hey @derlin this LGTM 👍 Thanks for the PR!

@pseudomuto pseudomuto merged commit c1b5714 into pseudomuto:master Oct 17, 2021
@derlin
Copy link
Contributor Author

derlin commented Oct 17, 2021

Wow, wasn't expecting such a fast response, thank YOU !

Do you think it could be possible to tag this contribution with the label hacktoberfest-accepted (see Hacktoberfest) ? It of course perfectly fine if you don't, this repo is great and I would have contributed to it anyways :)

@pseudomuto
Copy link
Owner

Tagged! Thanks again for the PR!

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

Successfully merging this pull request may close these issues.

None yet

2 participants