Escape special characters in Markdown anchors #460
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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