Update MD051/link-fragments to add ignore_case parameter and improve documentation (fixes #1274).

This commit is contained in:
David Anson 2024-10-08 22:40:11 -07:00
parent 74aa96d19d
commit 04c693b00b
16 changed files with 315 additions and 44 deletions

View file

@ -16,9 +16,9 @@ generated name (see below):
[Link](#heading-name)
```
Link fragments may be handled case-sensitively, so this rule requires fragments
to exactly match the [GitHub heading algorithm][github-heading-algorithm].
Therefore, the following example is reported as a violation:
For consistency, this rule requires fragments to exactly match the [GitHub
heading algorithm][github-heading-algorithm] which converts letters to
lowercase. Therefore, the following example is reported as a violation:
```markdown
# Heading Name
@ -26,6 +26,10 @@ Therefore, the following example is reported as a violation:
[Link](#Heading-Name)
```
To ignore case when comparing fragments with heading names, the `ignore_case`
parameter can be set to `true`. In this configuration, the previous example is
not reported as a violation.
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 `_`):