Add support for named heading fragments as supported by some platforms (fixes #830).

This commit is contained in:
David Anson 2023-07-08 22:14:00 -07:00
parent 3dcb66cac5
commit 7a794192ca
8 changed files with 295 additions and 18 deletions

View file

@ -2,17 +2,28 @@ This rule is triggered when a link fragment does not match any of the fragments
that are automatically generated for headings in a document:
```markdown
# Title
# Heading Name
[Link](#fragment)
```
To fix this issue, change the link fragment to reference an existing heading:
To fix this issue, change the link fragment to reference an existing heading's
generated name (see below):
```markdown
# Title
# Heading Name
[Link](#title)
[Link](#heading-name)
```
Alternatively, some platforms allow the syntax `{#named-anchor}` to be used
within a heading to provide a specific name (consisting of only lower-case
letters, numbers, `-`, and `_`):
```markdown
# Heading Name {#custom-name}
[Link](#custom-name)
```
Alternatively, an HTML `a` tag with an `id` or a `name` attribute can be used to