This rule ensures that link fragments in Markdown documents match existing headings or predefined anchors according to GitHub's heading algorithm.
ignore_case: Ignore case when comparing fragments (default:false)ignored_pattern: Regular expression to ignore specific fragment patterns (default:"")
Valid:
# Heading Name
[Link](#heading-name)Invalid:
# Heading Name
[Link](#Heading-Name) # Case mismatch- Custom named anchors:
# Heading {#custom-name} - HTML anchors:
<a id="bookmark"></a> - Special GitHub fragments:
[Link](#L20),[Link](#L19C5-L21C11)
"GitHub section links are created automatically for every heading when Markdown content is displayed on GitHub. This makes it easy to link directly to different sections within a document."
Update link fragments to match:
- Lowercase heading text
- Replace spaces with dashes
- Remove punctuation
- Append incrementing integer if needed for uniqueness
- Not part of CommonMark specification
- Follows GitHub's heading algorithm for fragment generation
- Uses GitHub's official specification as source of truth for special fragments
- May be more strict than some other implementations for better accuracy