markdownlint 0.39.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +17 -30
- package/doc/CustomRules.md +1 -1
- package/doc/Rules.md +140 -43
- package/doc/md001.md +1 -1
- package/doc/md011.md +1 -1
- package/doc/md022.md +15 -0
- package/doc/md025.md +1 -1
- package/doc/md026.md +1 -1
- package/doc/md028.md +13 -9
- package/doc/md034.md +1 -1
- package/doc/md035.md +12 -5
- package/doc/md041.md +2 -2
- package/doc/md042.md +6 -0
- package/doc/md045.md +1 -1
- package/doc/md051.md +10 -5
- package/doc/md060.md +76 -16
- package/helpers/README.md +4 -4
- package/helpers/helpers.cjs +45 -46
- package/helpers/micromark-helpers.cjs +4 -3
- package/helpers/package.json +2 -2
- package/helpers/shared.cjs +1 -1
- package/lib/configuration-strict.d.ts +124 -108
- package/lib/constants.mjs +2 -2
- package/lib/exports.d.mts +1 -0
- package/lib/exports.mjs +1 -0
- package/lib/markdownit.cjs +8 -7
- package/lib/markdownlint.d.mts +56 -41
- package/lib/markdownlint.mjs +35 -103
- package/lib/md011.mjs +8 -6
- package/lib/md013.mjs +14 -27
- package/lib/md022.mjs +14 -11
- package/lib/md029.mjs +3 -3
- package/lib/md036.mjs +1 -0
- package/lib/md051.mjs +2 -1
- package/lib/md060.mjs +107 -19
- package/lib/micromark-parse.mjs +21 -7
- package/lib/resolve-module.cjs +3 -3
- package/lib/resolve-module.d.cts +1 -1
- package/package.json +36 -38
- package/schema/.markdownlint.jsonc +58 -54
- package/schema/.markdownlint.yaml +57 -53
- package/schema/markdownlint-config-schema-strict.json +130 -110
- package/schema/markdownlint-config-schema.json +130 -110
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.41.0
|
|
4
|
+
|
|
5
|
+
- Improve MD022/MD028/MD035/MD042/MD051/MD060
|
|
6
|
+
- Remove handling of inline directive syntax (frequent false positives)
|
|
7
|
+
- Remove deprecated `Options.resultVersion` (breaking change)
|
|
8
|
+
- Remove deprecated `LintResults.toString` (breaking change)
|
|
9
|
+
- Remove support for end-of-life Node version 20
|
|
10
|
+
- Update dependencies
|
|
11
|
+
|
|
12
|
+
## 0.40.0
|
|
13
|
+
|
|
14
|
+
- Improve MD011/MD013/MD051/MD060
|
|
15
|
+
- Update dependencies
|
|
16
|
+
|
|
3
17
|
## 0.39.0
|
|
4
18
|
|
|
5
19
|
- Add MD060/table-column-style
|
package/CONTRIBUTING.md
CHANGED
|
@@ -83,8 +83,8 @@ Thank you!
|
|
|
83
83
|
[ava-snapshots]: https://github.com/avajs/ava/blob/main/docs/04-snapshot-testing.md
|
|
84
84
|
[closing-keywords]: https://help.github.com/articles/closing-issues-using-keywords/
|
|
85
85
|
[custom-rules]: doc/CustomRules.md
|
|
86
|
-
[dependencies]: https://docs.npmjs.com/
|
|
87
|
-
[example-com]: https://
|
|
86
|
+
[dependencies]: https://docs.npmjs.com/cli/v11/configuring-npm/package-json#dependencies
|
|
87
|
+
[example-com]: https://wikipedia.org/wiki/Example.com
|
|
88
88
|
[micromark]: https://www.npmjs.com/package/micromark
|
|
89
89
|
[new-rule]: https://github.com/DavidAnson/markdownlint/labels/new%20rule
|
|
90
90
|
[npm-scripts]: https://docs.npmjs.com/misc/scripts
|
package/README.md
CHANGED
|
@@ -28,16 +28,17 @@ documentation, and test cases came from that project.
|
|
|
28
28
|
[CommonMark][commonmark] specification for Markdown. It additionally supports
|
|
29
29
|
popular [GitHub Flavored Markdown (GFM)][gfm] syntax like autolinks and tables
|
|
30
30
|
as well as directives, footnotes, and math syntax - all implemented by
|
|
31
|
-
[`micromark` extensions][micromark-extensions].
|
|
31
|
+
[`micromark` extensions][micromark-extensions]. (Note that inline directives are
|
|
32
|
+
not supported to avoid confusion due to over-matching.)
|
|
32
33
|
|
|
33
34
|
[commonmark]: https://commonmark.org/
|
|
34
35
|
[gfm]: https://github.github.com/gfm/
|
|
35
|
-
[markdown]: https://
|
|
36
|
+
[markdown]: https://wikipedia.org/wiki/Markdown
|
|
36
37
|
[markdownlint-ruby]: https://github.com/markdownlint/markdownlint
|
|
37
38
|
[micromark]: https://github.com/micromark/micromark
|
|
38
39
|
[micromark-extensions]: https://github.com/micromark/micromark?tab=readme-ov-file#list-of-extensions
|
|
39
40
|
[nodejs]: https://nodejs.org/
|
|
40
|
-
[static-analysis]: https://
|
|
41
|
+
[static-analysis]: https://wikipedia.org/wiki/Static_program_analysis
|
|
41
42
|
|
|
42
43
|
### Related
|
|
43
44
|
|
|
@@ -206,11 +207,10 @@ issues reported. Two kinds of text are ignored by most rules:
|
|
|
206
207
|
- [Front matter](https://jekyllrb.com/docs/frontmatter/) (see
|
|
207
208
|
`options.frontMatter` below)
|
|
208
209
|
|
|
209
|
-
Rules can be enabled, disabled, and configured
|
|
210
|
-
|
|
211
|
-
To enable or disable rules
|
|
212
|
-
|
|
213
|
-
appear in the final markup):
|
|
210
|
+
All rules are enabled by default. Rules can be enabled, disabled, and configured
|
|
211
|
+
for each call to the `lint` API by passing an `options.config` object (described
|
|
212
|
+
below). To enable or disable rules within a file, use one of the following HTML
|
|
213
|
+
comments (which are not rendered):
|
|
214
214
|
|
|
215
215
|
- Disable all rules: `<!-- markdownlint-disable -->`
|
|
216
216
|
- Enable all rules: `<!-- markdownlint-enable -->`
|
|
@@ -490,7 +490,7 @@ See [.markdownlint.jsonc](schema/.markdownlint.jsonc) and/or
|
|
|
490
490
|
configuration object with all properties set to the default value.
|
|
491
491
|
|
|
492
492
|
Sets of rules (known as a "style") can be stored separately and loaded
|
|
493
|
-
as [JSON](https://
|
|
493
|
+
as [JSON](https://wikipedia.org/wiki/JSON).
|
|
494
494
|
|
|
495
495
|
Example of referencing a built-in style from JavaScript:
|
|
496
496
|
|
|
@@ -605,7 +605,7 @@ Type: `Array` of `String`
|
|
|
605
605
|
List of files to lint.
|
|
606
606
|
|
|
607
607
|
Each array element should be a single file (via relative or absolute path);
|
|
608
|
-
[globbing](https://
|
|
608
|
+
[globbing](https://wikipedia.org/wiki/Glob_%28programming%29) is the
|
|
609
609
|
caller's responsibility.
|
|
610
610
|
|
|
611
611
|
Example: `[ "one.md", "dir/two.md" ]`
|
|
@@ -627,9 +627,9 @@ The default value:
|
|
|
627
627
|
/((^---[^\S\r\n\u2028\u2029]*$[\s\S]+?^---\s*)|(^\+\+\+[^\S\r\n\u2028\u2029]*$[\s\S]+?^(\+\+\+|\.\.\.)\s*)|(^\{[^\S\r\n\u2028\u2029]*$[\s\S]+?^\}\s*))(\r\n|\r|\n|$)/m
|
|
628
628
|
```
|
|
629
629
|
|
|
630
|
-
Ignores [YAML](https://
|
|
631
|
-
[TOML](https://
|
|
632
|
-
[JSON](https://
|
|
630
|
+
Ignores [YAML](https://wikipedia.org/wiki/YAML),
|
|
631
|
+
[TOML](https://wikipedia.org/wiki/TOML), and
|
|
632
|
+
[JSON](https://wikipedia.org/wiki/JSON) front matter such as:
|
|
633
633
|
|
|
634
634
|
```text
|
|
635
635
|
---
|
|
@@ -716,16 +716,6 @@ By default, properly-formatted inline comments can be used to create exceptions
|
|
|
716
716
|
for parts of a document. Setting `noInlineConfig` to `true` ignores all such
|
|
717
717
|
comments.
|
|
718
718
|
|
|
719
|
-
##### ~~options.resultVersion~~
|
|
720
|
-
|
|
721
|
-
This property is *deprecated* and should be removed. The default format of the
|
|
722
|
-
`result` object remains the same as setting `resultVersion` to `3`. For
|
|
723
|
-
continued access to other (previously *deprecated*) formats:
|
|
724
|
-
|
|
725
|
-
```javascript
|
|
726
|
-
import { convertToResultVersion0, convertToResultVersion1, convertToResultVersion2 } from "markdownlint/helpers";
|
|
727
|
-
```
|
|
728
|
-
|
|
729
719
|
##### options.strings
|
|
730
720
|
|
|
731
721
|
Type: `Object` mapping `String` to `String`
|
|
@@ -980,7 +970,7 @@ All of which return an object like:
|
|
|
980
970
|
{ "lineNumber": 3,
|
|
981
971
|
"ruleNames": [ "MD010", "no-hard-tabs" ],
|
|
982
972
|
"ruleDescription": "Hard tabs",
|
|
983
|
-
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.
|
|
973
|
+
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md010.md",
|
|
984
974
|
"errorDetail": "Column: 17",
|
|
985
975
|
"errorContext": null,
|
|
986
976
|
"errorRange": [ 17, 1 ],
|
|
@@ -989,7 +979,7 @@ All of which return an object like:
|
|
|
989
979
|
{ "lineNumber": 1,
|
|
990
980
|
"ruleNames": [ "MD018", "no-missing-space-atx" ],
|
|
991
981
|
"ruleDescription": "No space after hash on atx style heading",
|
|
992
|
-
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.
|
|
982
|
+
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md018.md",
|
|
993
983
|
"errorDetail": null,
|
|
994
984
|
"errorContext": "#bad.md",
|
|
995
985
|
"errorRange": [ 1, 2 ],
|
|
@@ -998,7 +988,7 @@ All of which return an object like:
|
|
|
998
988
|
{ "lineNumber": 3,
|
|
999
989
|
"ruleNames": [ "MD018", "no-missing-space-atx" ],
|
|
1000
990
|
"ruleDescription": "No space after hash on atx style heading",
|
|
1001
|
-
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.
|
|
991
|
+
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md018.md",
|
|
1002
992
|
"errorDetail": null,
|
|
1003
993
|
"errorContext": "#This file fails\tsome rules.",
|
|
1004
994
|
"errorRange": [ 1, 2 ],
|
|
@@ -1007,7 +997,7 @@ All of which return an object like:
|
|
|
1007
997
|
{ "lineNumber": 1,
|
|
1008
998
|
"ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
|
|
1009
999
|
"ruleDescription": "First line in a file should be a top-level heading",
|
|
1010
|
-
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.
|
|
1000
|
+
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.41.0/doc/md041.md",
|
|
1011
1001
|
"errorDetail": null,
|
|
1012
1002
|
"errorContext": "#bad.md",
|
|
1013
1003
|
"errorRange": null,
|
|
@@ -1059,7 +1049,6 @@ following projects or one of the tools in the [Related section](#related):
|
|
|
1059
1049
|
- [Garden React Components][garden] ([Search repository][garden-search])
|
|
1060
1050
|
- [MDN Web Docs][mdn] ([Search repository][mdn-search])
|
|
1061
1051
|
- [MkDocs][mkdocs] ([Search repository][mkdocs-search])
|
|
1062
|
-
- [Mocha][mocha] ([Search repository][mocha-search])
|
|
1063
1052
|
- [Pi-hole documentation][pi-hole] ([Search repository][pi-hole-search])
|
|
1064
1053
|
- [Reactable][reactable] ([Search repository][reactable-search])
|
|
1065
1054
|
- [V8][v8] ([Search repository][v8-search])
|
|
@@ -1092,8 +1081,6 @@ For more advanced integration scenarios:
|
|
|
1092
1081
|
[mdn-search]: https://github.com/mdn/content/search?q=markdownlint
|
|
1093
1082
|
[mkdocs]: https://www.mkdocs.org/
|
|
1094
1083
|
[mkdocs-search]: https://github.com/mkdocs/mkdocs/search?q=markdownlint
|
|
1095
|
-
[mocha]: https://mochajs.org/
|
|
1096
|
-
[mocha-search]: https://github.com/mochajs/mocha/search?q=markdownlint
|
|
1097
1084
|
[pi-hole]: https://docs.pi-hole.net
|
|
1098
1085
|
[pi-hole-search]: https://github.com/pi-hole/docs/search?q=markdownlint
|
|
1099
1086
|
[reactable]: https://glittershark.github.io/reactable/
|
package/doc/CustomRules.md
CHANGED
|
@@ -191,4 +191,4 @@ throws an exception.
|
|
|
191
191
|
[rule-helpers]: https://www.npmjs.com/package/markdownlint-rule-helpers
|
|
192
192
|
[options-custom-rules]: ../README.md#optionscustomrules
|
|
193
193
|
[test-rules]: ../test/rules
|
|
194
|
-
[tokens]: ../test/
|
|
194
|
+
[tokens]: ../test/markdownlint-test-custom-rules.mjs.snapshot
|
package/doc/Rules.md
CHANGED
|
@@ -45,7 +45,7 @@ level at a time:
|
|
|
45
45
|
### Another Heading 3
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
If [YAML](https://
|
|
48
|
+
If [YAML](https://wikipedia.org/wiki/YAML) front matter is present and
|
|
49
49
|
contains a `title` property (commonly used with blog posts), this rule treats
|
|
50
50
|
that as a top level heading and will report a violation if the actual first
|
|
51
51
|
heading is not a level 2 heading. To use a different property name in the
|
|
@@ -426,7 +426,7 @@ To fix this, swap the `[]` and `()` around:
|
|
|
426
426
|
[Correct link syntax](https://www.example.com/)
|
|
427
427
|
```
|
|
428
428
|
|
|
429
|
-
Note: [Markdown Extra](https://
|
|
429
|
+
Note: [Markdown Extra](https://wikipedia.org/wiki/Markdown_Extra)-style
|
|
430
430
|
footnotes do not trigger this rule:
|
|
431
431
|
|
|
432
432
|
```markdown
|
|
@@ -731,6 +731,8 @@ Aliases: `blanks-around-headings`
|
|
|
731
731
|
|
|
732
732
|
Parameters:
|
|
733
733
|
|
|
734
|
+
- `include_front_matter`: Include front matter content (`boolean`, default
|
|
735
|
+
`false`)
|
|
734
736
|
- `lines_above`: Blank lines above heading (`integer|integer[]`, default `1`)
|
|
735
737
|
- `lines_below`: Blank lines below heading (`integer|integer[]`, default `1`)
|
|
736
738
|
|
|
@@ -772,6 +774,19 @@ blank line, [MD012/no-multiple-blanks](md012.md) should also be customized. This
|
|
|
772
774
|
rule checks for *at least* as many blank lines as specified; any extra blank
|
|
773
775
|
lines are ignored.
|
|
774
776
|
|
|
777
|
+
By default, [YAML](https://wikipedia.org/wiki/YAML) front matter is ignored, so
|
|
778
|
+
the following document reports no violations:
|
|
779
|
+
|
|
780
|
+
```markdown
|
|
781
|
+
---
|
|
782
|
+
title: Title
|
|
783
|
+
---
|
|
784
|
+
## Heading
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
To require the configured number of blank lines between front matter content and
|
|
788
|
+
a document's first heading, set the `include_front_matter` parameter to `true`.
|
|
789
|
+
|
|
775
790
|
Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`,
|
|
776
791
|
will not parse headings that don't have a blank line before, and will parse them
|
|
777
792
|
as regular text.
|
|
@@ -898,7 +913,7 @@ lower-level headings (h2, h3, etc.):
|
|
|
898
913
|
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
|
|
899
914
|
cases where an h1 is added externally.
|
|
900
915
|
|
|
901
|
-
If [YAML](https://
|
|
916
|
+
If [YAML](https://wikipedia.org/wiki/YAML) front matter is present and
|
|
902
917
|
contains a `title` property (commonly used with blog posts), this rule treats
|
|
903
918
|
that as a top level heading and will report a violation for any subsequent
|
|
904
919
|
top-level headings. To use a different property name in the front matter,
|
|
@@ -952,7 +967,7 @@ Rationale: Headings are not meant to be full sentences. More information:
|
|
|
952
967
|
[Punctuation at the end of headers][end-punctuation].
|
|
953
968
|
|
|
954
969
|
[end-punctuation]: https://cirosantilli.com/markdown-style-guide#punctuation-at-the-end-of-headers
|
|
955
|
-
[html-entity-references]: https://
|
|
970
|
+
[html-entity-references]: https://wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
|
|
956
971
|
|
|
957
972
|
<a name="md027"></a>
|
|
958
973
|
|
|
@@ -998,29 +1013,33 @@ Tags: `blockquote`, `whitespace`
|
|
|
998
1013
|
Aliases: `no-blanks-blockquote`
|
|
999
1014
|
|
|
1000
1015
|
This rule is triggered when two blockquote blocks are separated by nothing
|
|
1001
|
-
|
|
1016
|
+
but a blank line:
|
|
1002
1017
|
|
|
1003
1018
|
```markdown
|
|
1004
1019
|
> This is a blockquote
|
|
1005
1020
|
> which is immediately followed by
|
|
1006
1021
|
|
|
1007
|
-
> this blockquote.
|
|
1008
|
-
>
|
|
1022
|
+
> this blockquote. In some cases,
|
|
1023
|
+
> these may be merged into one blockquote.
|
|
1009
1024
|
```
|
|
1010
1025
|
|
|
1011
|
-
To fix this, ensure that
|
|
1012
|
-
|
|
1026
|
+
To fix this, ensure that consecutive blockquotes have text (or an HTML comment)
|
|
1027
|
+
in between:
|
|
1013
1028
|
|
|
1014
1029
|
```markdown
|
|
1015
1030
|
> This is a blockquote.
|
|
1016
1031
|
|
|
1017
|
-
|
|
1032
|
+
This is paragraph text.
|
|
1033
|
+
|
|
1034
|
+
> This is a second blockquote.
|
|
1018
1035
|
|
|
1019
|
-
|
|
1036
|
+
<!-- This is an HTML comment -->
|
|
1037
|
+
|
|
1038
|
+
> This is a third blockquote.
|
|
1020
1039
|
```
|
|
1021
1040
|
|
|
1022
|
-
|
|
1023
|
-
|
|
1041
|
+
If they are meant to be a single quote, add the blockquote symbol at the
|
|
1042
|
+
beginning of the blank line:
|
|
1024
1043
|
|
|
1025
1044
|
```markdown
|
|
1026
1045
|
> This is a blockquote.
|
|
@@ -1392,7 +1411,7 @@ For more info, visit <https://www.example.com/> or email <user@example.com>.
|
|
|
1392
1411
|
|
|
1393
1412
|
If a URL or email address contains non-ASCII characters, it may be not be
|
|
1394
1413
|
handled as intended even when angle brackets are present. In such cases,
|
|
1395
|
-
[percent-encoding](https://
|
|
1414
|
+
[percent-encoding](https://wikipedia.org/wiki/Percent-encoding) can be used
|
|
1396
1415
|
to comply with the required syntax for URL and email.
|
|
1397
1416
|
|
|
1398
1417
|
Note: To include a bare URL or email without it being converted into a link,
|
|
@@ -1437,8 +1456,8 @@ Parameters:
|
|
|
1437
1456
|
|
|
1438
1457
|
- `style`: Horizontal rule style (`string`, default `consistent`)
|
|
1439
1458
|
|
|
1440
|
-
This rule is triggered when inconsistent styles of horizontal rules
|
|
1441
|
-
in
|
|
1459
|
+
This rule is triggered when inconsistent styles of horizontal rules (also known
|
|
1460
|
+
as "thematic breaks") are used in a document:
|
|
1442
1461
|
|
|
1443
1462
|
```markdown
|
|
1444
1463
|
---
|
|
@@ -1452,16 +1471,23 @@ in the document:
|
|
|
1452
1471
|
****
|
|
1453
1472
|
```
|
|
1454
1473
|
|
|
1455
|
-
To fix this, use the same horizontal rule everywhere:
|
|
1474
|
+
To fix this, use the same horizontal rule syntax everywhere:
|
|
1456
1475
|
|
|
1457
1476
|
```markdown
|
|
1458
1477
|
---
|
|
1459
1478
|
|
|
1479
|
+
---
|
|
1480
|
+
|
|
1460
1481
|
---
|
|
1461
1482
|
```
|
|
1462
1483
|
|
|
1463
|
-
The
|
|
1464
|
-
|
|
1484
|
+
The `style` parameter's default value `consistent` ensures all horizontal rules
|
|
1485
|
+
in a document match the first horizontal rule in that document. To enforce a
|
|
1486
|
+
specific pattern of characters, set the `style` parameter to that string (e.g.,
|
|
1487
|
+
`"* * *"`).
|
|
1488
|
+
|
|
1489
|
+
Note: In order to be recognized as a horizontal rule, a line must contain three
|
|
1490
|
+
or more matching `-`, `_`, or `*` characters with optional space between.
|
|
1465
1491
|
|
|
1466
1492
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1467
1493
|
|
|
@@ -1750,9 +1776,9 @@ in cases where an `h1` is added externally.
|
|
|
1750
1776
|
Rationale: The top-level heading often acts as the title of a document. More
|
|
1751
1777
|
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
|
|
1752
1778
|
|
|
1753
|
-
[HTML]: https://
|
|
1779
|
+
[HTML]: https://wikipedia.org/wiki/HTML
|
|
1754
1780
|
[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
|
|
1755
|
-
[YAML]: https://
|
|
1781
|
+
[YAML]: https://wikipedia.org/wiki/YAML
|
|
1756
1782
|
|
|
1757
1783
|
<a name="md042"></a>
|
|
1758
1784
|
|
|
@@ -1778,6 +1804,10 @@ Empty fragments will trigger this rule:
|
|
|
1778
1804
|
|
|
1779
1805
|
```markdown
|
|
1780
1806
|
[an empty fragment](#)
|
|
1807
|
+
|
|
1808
|
+
[an empty link definition][empty]
|
|
1809
|
+
|
|
1810
|
+
[empty]: #
|
|
1781
1811
|
```
|
|
1782
1812
|
|
|
1783
1813
|
But non-empty fragments will not:
|
|
@@ -1786,6 +1816,8 @@ But non-empty fragments will not:
|
|
|
1786
1816
|
[a valid fragment](#fragment)
|
|
1787
1817
|
```
|
|
1788
1818
|
|
|
1819
|
+
Empty link definitions
|
|
1820
|
+
|
|
1789
1821
|
Rationale: Empty links do not lead anywhere and therefore don't function as
|
|
1790
1822
|
links.
|
|
1791
1823
|
|
|
@@ -1976,7 +2008,7 @@ content of an image for people who may not be able to see it.
|
|
|
1976
2008
|
[aria-hidden]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-hidden
|
|
1977
2009
|
[phase2technology]: https://www.phase2technology.com/blog/no-more-excuses
|
|
1978
2010
|
[w3c]: https://www.w3.org/WAI/alt/
|
|
1979
|
-
[wikipedia]: https://
|
|
2011
|
+
[wikipedia]: https://wikipedia.org/wiki/Alt_attribute
|
|
1980
2012
|
|
|
1981
2013
|
<a name="md046"></a>
|
|
1982
2014
|
|
|
@@ -2284,14 +2316,19 @@ This makes it easy to link directly to different sections within a document.
|
|
|
2284
2316
|
However, section links change if headings are renamed or removed. This rule
|
|
2285
2317
|
helps identify broken section links within a document.
|
|
2286
2318
|
|
|
2287
|
-
Section links are **not** part of the CommonMark specification
|
|
2288
|
-
enforces the [GitHub heading algorithm][github-heading-algorithm]
|
|
2289
|
-
|
|
2290
|
-
|
|
2319
|
+
Note: Section links are **not** part of the CommonMark specification; this rule
|
|
2320
|
+
enforces the [GitHub heading algorithm][github-heading-algorithm]:
|
|
2321
|
+
|
|
2322
|
+
1. Convert text to lowercase
|
|
2323
|
+
2. Remove punctuation characters
|
|
2324
|
+
3. Convert spaces to dashes
|
|
2325
|
+
4. Append an incrementing integer (as needed for uniqueness)
|
|
2326
|
+
5. [URI-encode][encodeURIComponent] the result
|
|
2291
2327
|
|
|
2328
|
+
[encodeURIComponent]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
|
|
2292
2329
|
[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
|
|
2293
2330
|
[github-heading-algorithm]: https://github.com/gjtorikian/html-pipeline/blob/f13a1534cb650ba17af400d1acd3a22c28004c09/lib/html/pipeline/toc_filter.rb
|
|
2294
|
-
[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
|
|
2331
|
+
[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
|
|
2295
2332
|
[html-top-fragment]: https://html.spec.whatwg.org/multipage/browsing-the-web.html#scrolling-to-a-fragment
|
|
2296
2333
|
[RegEx]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
|
|
2297
2334
|
|
|
@@ -2689,15 +2726,18 @@ Aliases: `table-column-style`
|
|
|
2689
2726
|
|
|
2690
2727
|
Parameters:
|
|
2691
2728
|
|
|
2729
|
+
- `aligned_delimiter`: Aligned delimiter columns (`boolean`, default `false`)
|
|
2692
2730
|
- `style`: Table column style (`string`, default `any`, values `aligned` /
|
|
2693
2731
|
`any` / `compact` / `tight`)
|
|
2694
2732
|
|
|
2695
|
-
|
|
2733
|
+
Fixable: Some violations can be fixed by tooling
|
|
2734
|
+
|
|
2735
|
+
This rule is triggered when the column separator pipe characters (`|`) of a
|
|
2696
2736
|
[GitHub Flavored Markdown table][gfm-table-060] are used inconsistently.
|
|
2697
2737
|
|
|
2698
|
-
This rule recognizes three table column styles based on popular use
|
|
2738
|
+
This rule recognizes three table column styles based on popular use.
|
|
2699
2739
|
|
|
2700
|
-
Style `aligned`
|
|
2740
|
+
Style `aligned` ensures pipe characters are vertically aligned:
|
|
2701
2741
|
|
|
2702
2742
|
```markdown
|
|
2703
2743
|
| Character | Meaning |
|
|
@@ -2706,7 +2746,16 @@ Style `aligned` looks the most like a table:
|
|
|
2706
2746
|
| N | No |
|
|
2707
2747
|
```
|
|
2708
2748
|
|
|
2709
|
-
|
|
2749
|
+
The `aligned` style ignores cell content, so the following is also valid:
|
|
2750
|
+
|
|
2751
|
+
```markdown
|
|
2752
|
+
| Character | Meaning |
|
|
2753
|
+
|-----------|---------|
|
|
2754
|
+
| Y | Yes |
|
|
2755
|
+
| N | No |
|
|
2756
|
+
```
|
|
2757
|
+
|
|
2758
|
+
Style `compact` avoids extra padding with a single space around cell content:
|
|
2710
2759
|
|
|
2711
2760
|
```markdown
|
|
2712
2761
|
| Character | Meaning |
|
|
@@ -2715,7 +2764,7 @@ Style `compact` uses a single space to pad cell content:
|
|
|
2715
2764
|
| N | No |
|
|
2716
2765
|
```
|
|
2717
2766
|
|
|
2718
|
-
Style `tight` uses no padding for cell content:
|
|
2767
|
+
Style `tight` uses no padding at all for cell content:
|
|
2719
2768
|
|
|
2720
2769
|
```markdown
|
|
2721
2770
|
|Character|Meaning|
|
|
@@ -2725,16 +2774,61 @@ Style `tight` uses no padding for cell content:
|
|
|
2725
2774
|
```
|
|
2726
2775
|
|
|
2727
2776
|
When this rule's `style` parameter is set to `aligned`, `compact`, or `tight`,
|
|
2728
|
-
every table must match the corresponding pattern and
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2777
|
+
every table must match the corresponding pattern and any violations will be
|
|
2778
|
+
reported. By default, or when the `any` style is used, each table is analyzed to
|
|
2779
|
+
see if it satisfies any supported style. If so, no violations are reported. If
|
|
2780
|
+
not, violations are be reported for whichever style would produce the *fewest*
|
|
2781
|
+
issues (i.e., whichever style is the closest match).
|
|
2782
|
+
|
|
2783
|
+
Setting the `aligned_delimiter` parameter to `true` requires pipe characters in
|
|
2784
|
+
the delimiter row to align with those in the header row. This can be used with
|
|
2785
|
+
`compact` and `tight` tables to make the header text more obvious. (It's already
|
|
2786
|
+
required for tables with style `aligned`.)
|
|
2787
|
+
|
|
2788
|
+
Style `compact` with `aligned_delimiter`:
|
|
2789
|
+
|
|
2790
|
+
```markdown
|
|
2791
|
+
| Character | Meaning |
|
|
2792
|
+
| --------- | ------- |
|
|
2793
|
+
| Y | Yes |
|
|
2794
|
+
| N | No |
|
|
2795
|
+
```
|
|
2796
|
+
|
|
2797
|
+
Style `tight` with `aligned_delimiter`:
|
|
2798
|
+
|
|
2799
|
+
```markdown
|
|
2800
|
+
|Character|Meaning|
|
|
2801
|
+
|---------|-------|
|
|
2802
|
+
|Y|Yes|
|
|
2803
|
+
|N|No|
|
|
2804
|
+
```
|
|
2805
|
+
|
|
2806
|
+
Violations for styles `compact` and `tight` are simple/independent and can be
|
|
2807
|
+
fixed automatically. However, fixing even single violations for style `aligned`
|
|
2808
|
+
may require modifying the entire table, and therefore are not automatic:
|
|
2809
|
+
|
|
2810
|
+
```markdown
|
|
2811
|
+
|Alpha |Delta|
|
|
2812
|
+
|------|-----|
|
|
2813
|
+
|Charlie|Beta|
|
|
2814
|
+
```
|
|
2815
|
+
|
|
2816
|
+
**Note**: This rule does not require leading/trailing pipe characters, so this
|
|
2817
|
+
is also a valid table for style `compact`:
|
|
2818
|
+
|
|
2819
|
+
```markdown
|
|
2820
|
+
Character | Meaning
|
|
2821
|
+
--- | ---
|
|
2822
|
+
Y | Yes
|
|
2823
|
+
N | No
|
|
2824
|
+
```
|
|
2733
2825
|
|
|
2734
|
-
Note
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2826
|
+
**Note**: Pipe alignment for the `aligned` style is based on visual appearance
|
|
2827
|
+
and not character count. Because editors typically render [emoji][emoji] and
|
|
2828
|
+
[CJK characters][cjk-characters] at *twice* the width of
|
|
2829
|
+
[Latin characters][latin-script], this rule takes that into account for tables
|
|
2830
|
+
using the `aligned` style. The following table is correctly formatted and will
|
|
2831
|
+
appear aligned in most editors and monospaced fonts:
|
|
2738
2832
|
|
|
2739
2833
|
<!-- markdownlint-capture -->
|
|
2740
2834
|
<!-- markdownlint-disable extended-ascii -->
|
|
@@ -2742,15 +2836,18 @@ editors render the emoji wider:
|
|
|
2742
2836
|
```markdown
|
|
2743
2837
|
| Response | Emoji |
|
|
2744
2838
|
| -------- | ----- |
|
|
2745
|
-
| Yes | ✅
|
|
2746
|
-
| No | ❎
|
|
2839
|
+
| Yes | ✅ |
|
|
2840
|
+
| No | ❎ |
|
|
2747
2841
|
```
|
|
2748
2842
|
|
|
2749
2843
|
<!-- markdownlint-restore -->
|
|
2750
2844
|
|
|
2751
2845
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
2752
2846
|
|
|
2847
|
+
[cjk-characters]: https://wikipedia.org/wiki/CJK_characters
|
|
2848
|
+
[emoji]: https://wikipedia.org/wiki/Emoji
|
|
2753
2849
|
[gfm-table-060]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|
|
2850
|
+
[latin-script]: https://wikipedia.org/wiki/Latin_script
|
|
2754
2851
|
|
|
2755
2852
|
<!-- markdownlint-configure-file {
|
|
2756
2853
|
"no-inline-html": {
|
package/doc/md001.md
CHANGED
|
@@ -37,7 +37,7 @@ level at a time:
|
|
|
37
37
|
### Another Heading 3
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
If [YAML](https://
|
|
40
|
+
If [YAML](https://wikipedia.org/wiki/YAML) front matter is present and
|
|
41
41
|
contains a `title` property (commonly used with blog posts), this rule treats
|
|
42
42
|
that as a top level heading and will report a violation if the actual first
|
|
43
43
|
heading is not a level 2 heading. To use a different property name in the
|
package/doc/md011.md
CHANGED
|
@@ -20,7 +20,7 @@ To fix this, swap the `[]` and `()` around:
|
|
|
20
20
|
[Correct link syntax](https://www.example.com/)
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Note: [Markdown Extra](https://
|
|
23
|
+
Note: [Markdown Extra](https://wikipedia.org/wiki/Markdown_Extra)-style
|
|
24
24
|
footnotes do not trigger this rule:
|
|
25
25
|
|
|
26
26
|
```markdown
|
package/doc/md022.md
CHANGED
|
@@ -6,6 +6,8 @@ Aliases: `blanks-around-headings`
|
|
|
6
6
|
|
|
7
7
|
Parameters:
|
|
8
8
|
|
|
9
|
+
- `include_front_matter`: Include front matter content (`boolean`, default
|
|
10
|
+
`false`)
|
|
9
11
|
- `lines_above`: Blank lines above heading (`integer|integer[]`, default `1`)
|
|
10
12
|
- `lines_below`: Blank lines below heading (`integer|integer[]`, default `1`)
|
|
11
13
|
|
|
@@ -47,6 +49,19 @@ blank line, [MD012/no-multiple-blanks](md012.md) should also be customized. This
|
|
|
47
49
|
rule checks for *at least* as many blank lines as specified; any extra blank
|
|
48
50
|
lines are ignored.
|
|
49
51
|
|
|
52
|
+
By default, [YAML](https://wikipedia.org/wiki/YAML) front matter is ignored, so
|
|
53
|
+
the following document reports no violations:
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
---
|
|
57
|
+
title: Title
|
|
58
|
+
---
|
|
59
|
+
## Heading
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
To require the configured number of blank lines between front matter content and
|
|
63
|
+
a document's first heading, set the `include_front_matter` parameter to `true`.
|
|
64
|
+
|
|
50
65
|
Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`,
|
|
51
66
|
will not parse headings that don't have a blank line before, and will parse them
|
|
52
67
|
as regular text.
|
package/doc/md025.md
CHANGED
|
@@ -35,7 +35,7 @@ lower-level headings (h2, h3, etc.):
|
|
|
35
35
|
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
|
|
36
36
|
cases where an h1 is added externally.
|
|
37
37
|
|
|
38
|
-
If [YAML](https://
|
|
38
|
+
If [YAML](https://wikipedia.org/wiki/YAML) front matter is present and
|
|
39
39
|
contains a `title` property (commonly used with blog posts), this rule treats
|
|
40
40
|
that as a top level heading and will report a violation for any subsequent
|
|
41
41
|
top-level headings. To use a different property name in the front matter,
|
package/doc/md026.md
CHANGED
|
@@ -37,4 +37,4 @@ Rationale: Headings are not meant to be full sentences. More information:
|
|
|
37
37
|
[Punctuation at the end of headers][end-punctuation].
|
|
38
38
|
|
|
39
39
|
[end-punctuation]: https://cirosantilli.com/markdown-style-guide#punctuation-at-the-end-of-headers
|
|
40
|
-
[html-entity-references]: https://
|
|
40
|
+
[html-entity-references]: https://wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
|
package/doc/md028.md
CHANGED
|
@@ -5,29 +5,33 @@ Tags: `blockquote`, `whitespace`
|
|
|
5
5
|
Aliases: `no-blanks-blockquote`
|
|
6
6
|
|
|
7
7
|
This rule is triggered when two blockquote blocks are separated by nothing
|
|
8
|
-
|
|
8
|
+
but a blank line:
|
|
9
9
|
|
|
10
10
|
```markdown
|
|
11
11
|
> This is a blockquote
|
|
12
12
|
> which is immediately followed by
|
|
13
13
|
|
|
14
|
-
> this blockquote.
|
|
15
|
-
>
|
|
14
|
+
> this blockquote. In some cases,
|
|
15
|
+
> these may be merged into one blockquote.
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
To fix this, ensure that
|
|
19
|
-
|
|
18
|
+
To fix this, ensure that consecutive blockquotes have text (or an HTML comment)
|
|
19
|
+
in between:
|
|
20
20
|
|
|
21
21
|
```markdown
|
|
22
22
|
> This is a blockquote.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
This is paragraph text.
|
|
25
25
|
|
|
26
|
-
> This
|
|
26
|
+
> This is a second blockquote.
|
|
27
|
+
|
|
28
|
+
<!-- This is an HTML comment -->
|
|
29
|
+
|
|
30
|
+
> This is a third blockquote.
|
|
27
31
|
```
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
If they are meant to be a single quote, add the blockquote symbol at the
|
|
34
|
+
beginning of the blank line:
|
|
31
35
|
|
|
32
36
|
```markdown
|
|
33
37
|
> This is a blockquote.
|
package/doc/md034.md
CHANGED
|
@@ -21,7 +21,7 @@ For more info, visit <https://www.example.com/> or email <user@example.com>.
|
|
|
21
21
|
|
|
22
22
|
If a URL or email address contains non-ASCII characters, it may be not be
|
|
23
23
|
handled as intended even when angle brackets are present. In such cases,
|
|
24
|
-
[percent-encoding](https://
|
|
24
|
+
[percent-encoding](https://wikipedia.org/wiki/Percent-encoding) can be used
|
|
25
25
|
to comply with the required syntax for URL and email.
|
|
26
26
|
|
|
27
27
|
Note: To include a bare URL or email without it being converted into a link,
|