mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-21 00:10:13 +01:00
967 B
967 B
MD051 - Link fragments should be valid
Tags: links
Aliases: link-fragments
This rule is triggered when a link fragment does not correspond to a heading in the document:
# Title
[Link](#fragment)
To fix the issue, change the fragment to reference an existing heading:
[Link](#title)
Alternatively, an HTML a tag with an id (or a name) attribute defines a
valid anchor:
<a id="fragment"></a>
Some platforms (e.g., GitHub) automatically create HTML anchors for every heading. This makes it easy to link to different sections in a document. These internal links can break over time as headings are renamed.
Note: Creating anchors for headings is not part of the CommonMark specification.