mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update documentation for MD051/link-fragments to mention encodeURIComponent (refs #1858).
This commit is contained in:
parent
4b948627aa
commit
846475f203
3 changed files with 27 additions and 12 deletions
13
doc/Rules.md
13
doc/Rules.md
|
|
@ -2284,11 +2284,16 @@ This makes it easy to link directly to different sections within a document.
|
|||
However, section links change if headings are renamed or removed. This rule
|
||||
helps identify broken section links within a document.
|
||||
|
||||
Section links are **not** part of the CommonMark specification. This rule
|
||||
enforces the [GitHub heading algorithm][github-heading-algorithm] which is:
|
||||
convert heading to lowercase, remove punctuation, convert spaces to dashes,
|
||||
append an incrementing integer as needed for uniqueness.
|
||||
Note: Section links are **not** part of the CommonMark specification; this rule
|
||||
enforces the [GitHub heading algorithm][github-heading-algorithm]:
|
||||
|
||||
1. Convert text to lowercase
|
||||
2. Remove punctuation characters
|
||||
3. Convert spaces to dashes
|
||||
4. Append an incrementing integer (as needed for uniqueness)
|
||||
5. [URI-encode][encodeURIComponent] the result
|
||||
|
||||
[encodeURIComponent]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
|
||||
[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
|
||||
[github-heading-algorithm]: https://github.com/gjtorikian/html-pipeline/blob/f13a1534cb650ba17af400d1acd3a22c28004c09/lib/html/pipeline/toc_filter.rb
|
||||
[github-linking-to-content]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-a-permanent-link-to-a-code-snippet#linking-to-markdown
|
||||
|
|
|
|||
13
doc/md051.md
13
doc/md051.md
|
|
@ -100,11 +100,16 @@ This makes it easy to link directly to different sections within a document.
|
|||
However, section links change if headings are renamed or removed. This rule
|
||||
helps identify broken section links within a document.
|
||||
|
||||
Section links are **not** part of the CommonMark specification. This rule
|
||||
enforces the [GitHub heading algorithm][github-heading-algorithm] which is:
|
||||
convert heading to lowercase, remove punctuation, convert spaces to dashes,
|
||||
append an incrementing integer as needed for uniqueness.
|
||||
Note: Section links are **not** part of the CommonMark specification; this rule
|
||||
enforces the [GitHub heading algorithm][github-heading-algorithm]:
|
||||
|
||||
1. Convert text to lowercase
|
||||
2. Remove punctuation characters
|
||||
3. Convert spaces to dashes
|
||||
4. Append an incrementing integer (as needed for uniqueness)
|
||||
5. [URI-encode][encodeURIComponent] the result
|
||||
|
||||
[encodeURIComponent]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
|
||||
[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
|
||||
[github-heading-algorithm]: https://github.com/gjtorikian/html-pipeline/blob/f13a1534cb650ba17af400d1acd3a22c28004c09/lib/html/pipeline/toc_filter.rb
|
||||
[github-linking-to-content]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-a-permanent-link-to-a-code-snippet#linking-to-markdown
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue