mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Generate Rules.md and md###.md files from metadata, improve Parameters documentation by referencing schema.
This commit is contained in:
parent
32c75ebfd9
commit
37baddcf27
110 changed files with 3875 additions and 179 deletions
35
doc/md051.md
Normal file
35
doc/md051.md
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# 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:
|
||||
|
||||
```markdown
|
||||
# Title
|
||||
|
||||
[Link](#fragment)
|
||||
```
|
||||
|
||||
To fix the issue, change the fragment to reference an existing heading:
|
||||
|
||||
```markdown
|
||||
[Link](#title)
|
||||
```
|
||||
|
||||
Alternatively, an HTML `a` tag with an `id` (or a `name`) attribute defines a
|
||||
valid anchor:
|
||||
|
||||
```markdown
|
||||
<a id="fragment"></a>
|
||||
```
|
||||
|
||||
Some platforms (e.g., [GitHub][github-section-links]) 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.
|
||||
|
||||
[github-section-links]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links
|
||||
Loading…
Add table
Add a link
Reference in a new issue