markdownlint 0.37.4 → 0.39.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 +20 -0
- package/CONTRIBUTING.md +2 -3
- package/README.md +175 -87
- package/doc/Rules.md +273 -47
- package/doc/md001.md +14 -0
- package/doc/md009.md +8 -9
- package/doc/md010.md +6 -0
- package/doc/md027.md +8 -0
- package/doc/md029.md +2 -0
- package/doc/md033.md +7 -1
- package/doc/md038.md +23 -11
- package/doc/md041.md +31 -16
- package/doc/md043.md +22 -4
- package/doc/md045.md +9 -1
- package/doc/md051.md +17 -0
- package/doc/md052.md +12 -0
- package/doc/md053.md +3 -3
- package/doc/md055.md +1 -1
- package/doc/md056.md +1 -1
- package/doc/md059.md +33 -0
- package/doc/md060.md +70 -0
- package/helpers/README.md +2 -2
- package/helpers/helpers.cjs +174 -20
- package/helpers/micromark-helpers.cjs +37 -7
- package/helpers/package.json +1 -1
- package/lib/cache.mjs +25 -7
- package/lib/configuration-strict.d.ts +1494 -292
- package/lib/constants.mjs +6 -5
- package/lib/defer-require.cjs +2 -0
- package/lib/exports.d.mts +2 -2
- package/lib/exports.mjs +2 -2
- package/lib/markdownit.cjs +8 -14
- package/lib/markdownlint.d.mts +136 -52
- package/lib/markdownlint.mjs +469 -409
- package/lib/md001.mjs +6 -2
- package/lib/md004.mjs +7 -18
- package/lib/md007.mjs +2 -1
- package/lib/md009.mjs +9 -5
- package/lib/md010.mjs +1 -1
- package/lib/md022.mjs +5 -2
- package/lib/md025.mjs +23 -15
- package/lib/md027.mjs +11 -1
- package/lib/md029.mjs +25 -14
- package/lib/md031.mjs +0 -1
- package/lib/md032.mjs +3 -1
- package/lib/md033.mjs +28 -20
- package/lib/md034.mjs +2 -1
- package/lib/md036.mjs +16 -4
- package/lib/md037.mjs +10 -7
- package/lib/md038.mjs +52 -71
- package/lib/md041.mjs +54 -16
- package/lib/md042.mjs +4 -2
- package/lib/md043.mjs +4 -2
- package/lib/md044.mjs +1 -1
- package/lib/md045.mjs +3 -1
- package/lib/md046.mjs +6 -6
- package/lib/md051.mjs +13 -5
- package/lib/md052.mjs +2 -1
- package/lib/md053.mjs +1 -1
- package/lib/md054.mjs +7 -5
- package/lib/md055.mjs +7 -6
- package/lib/md056.mjs +1 -1
- package/lib/md059.mjs +71 -0
- package/lib/md060.mjs +121 -0
- package/lib/micromark-parse.mjs +17 -3
- package/lib/node-imports-browser.mjs +2 -0
- package/lib/parse-configuration.mjs +47 -0
- package/lib/rules.mjs +5 -1
- package/package.json +32 -30
- package/schema/.markdownlint.jsonc +97 -62
- package/schema/.markdownlint.yaml +86 -57
- package/schema/markdownlint-config-schema-strict.json +4713 -1436
- package/schema/markdownlint-config-schema.json +4713 -1436
package/doc/Rules.md
CHANGED
|
@@ -12,6 +12,11 @@ Tags: `headings`
|
|
|
12
12
|
|
|
13
13
|
Aliases: `heading-increment`
|
|
14
14
|
|
|
15
|
+
Parameters:
|
|
16
|
+
|
|
17
|
+
- `front_matter_title`: RegExp for matching title in front matter (`string`,
|
|
18
|
+
default `^\s*title\s*[:=]`)
|
|
19
|
+
|
|
15
20
|
This rule is triggered when you skip heading levels in a Markdown document, for
|
|
16
21
|
example:
|
|
17
22
|
|
|
@@ -40,6 +45,15 @@ level at a time:
|
|
|
40
45
|
### Another Heading 3
|
|
41
46
|
```
|
|
42
47
|
|
|
48
|
+
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
|
|
49
|
+
contains a `title` property (commonly used with blog posts), this rule treats
|
|
50
|
+
that as a top level heading and will report a violation if the actual first
|
|
51
|
+
heading is not a level 2 heading. To use a different property name in the
|
|
52
|
+
front matter, specify the text of a regular expression via the
|
|
53
|
+
`front_matter_title` parameter. To disable the use of front matter by this
|
|
54
|
+
rule, specify `""` for `front_matter_title`. When front matter is not present,
|
|
55
|
+
the first heading can be any level.
|
|
56
|
+
|
|
43
57
|
Rationale: Headings represent the structure of a document and can be confusing
|
|
44
58
|
when skipped - especially for accessibility scenarios. More information:
|
|
45
59
|
<https://www.w3.org/WAI/tutorials/page-structure/headings/>.
|
|
@@ -281,6 +295,7 @@ Aliases: `no-trailing-spaces`
|
|
|
281
295
|
Parameters:
|
|
282
296
|
|
|
283
297
|
- `br_spaces`: Spaces for line break (`integer`, default `2`)
|
|
298
|
+
- `code_blocks`: Include code blocks (`boolean`, default `false`)
|
|
284
299
|
- `list_item_empty_lines`: Allow spaces for empty lines in list items
|
|
285
300
|
(`boolean`, default `false`)
|
|
286
301
|
- `strict`: Include unnecessary breaks (`boolean`, default `false`)
|
|
@@ -290,21 +305,19 @@ Fixable: Some violations can be fixed by tooling
|
|
|
290
305
|
This rule is triggered on any lines that end with unexpected whitespace. To fix
|
|
291
306
|
this, remove the trailing space from the end of the line.
|
|
292
307
|
|
|
293
|
-
Note: Trailing space is allowed in indented and fenced code blocks because some
|
|
294
|
-
languages require it.
|
|
295
|
-
|
|
296
308
|
The `br_spaces` parameter allows an exception to this rule for a specific number
|
|
297
309
|
of trailing spaces, typically used to insert an explicit line break. The default
|
|
298
|
-
value allows 2 spaces to indicate a hard break (\<br> element).
|
|
310
|
+
value allows 2 spaces to indicate a hard break (\<br> element). (You must set
|
|
311
|
+
`br_spaces` to a value >= 2 for this parameter to take effect. Setting
|
|
312
|
+
`br_spaces` to 1 behaves the same as 0, disallowing any trailing spaces.)
|
|
299
313
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
314
|
+
By default, trailing space is allowed in indented and fenced code blocks because
|
|
315
|
+
some programming languages require that. To report such instances, set the
|
|
316
|
+
`code_blocks` parameter to `true`.
|
|
303
317
|
|
|
304
318
|
By default, this rule will not trigger when the allowed number of spaces is
|
|
305
319
|
used, even when it doesn't create a hard break (for example, at the end of a
|
|
306
|
-
paragraph). To report such instances
|
|
307
|
-
`true`.
|
|
320
|
+
paragraph). To report such instances, set the `strict` parameter to `true`.
|
|
308
321
|
|
|
309
322
|
```markdown
|
|
310
323
|
Text text text
|
|
@@ -383,6 +396,12 @@ parameter to the desired value.
|
|
|
383
396
|
Rationale: Hard tabs are often rendered inconsistently by different editors and
|
|
384
397
|
can be harder to work with than spaces.
|
|
385
398
|
|
|
399
|
+
More information:
|
|
400
|
+
|
|
401
|
+
- <https://agiletribe.wordpress.com/2011/10/27/18-dont-use-tab-characters/>
|
|
402
|
+
- <https://www.jwz.org/doc/tabs-vs-spaces.html>
|
|
403
|
+
- <https://adamspiers.org/computing/why_no_tabs.html>
|
|
404
|
+
|
|
386
405
|
<a name="md011"></a>
|
|
387
406
|
|
|
388
407
|
## `MD011` - Reversed link syntax
|
|
@@ -943,6 +962,10 @@ Tags: `blockquote`, `indentation`, `whitespace`
|
|
|
943
962
|
|
|
944
963
|
Aliases: `no-multiple-space-blockquote`
|
|
945
964
|
|
|
965
|
+
Parameters:
|
|
966
|
+
|
|
967
|
+
- `list_items`: Include list items (`boolean`, default `true`)
|
|
968
|
+
|
|
946
969
|
Fixable: Some violations can be fixed by tooling
|
|
947
970
|
|
|
948
971
|
This rule is triggered when blockquotes have more than one space after the
|
|
@@ -960,6 +983,10 @@ To fix, remove any extraneous space:
|
|
|
960
983
|
> indentation.
|
|
961
984
|
```
|
|
962
985
|
|
|
986
|
+
Inferring intended list indentation within a blockquote can be challenging;
|
|
987
|
+
setting the `list_items` parameter to `false` disables this rule for ordered
|
|
988
|
+
and unordered list items.
|
|
989
|
+
|
|
963
990
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
964
991
|
|
|
965
992
|
<a name="md028"></a>
|
|
@@ -1018,6 +1045,8 @@ Parameters:
|
|
|
1018
1045
|
- `style`: List style (`string`, default `one_or_ordered`, values `one` /
|
|
1019
1046
|
`one_or_ordered` / `ordered` / `zero`)
|
|
1020
1047
|
|
|
1048
|
+
Fixable: Some violations can be fixed by tooling
|
|
1049
|
+
|
|
1021
1050
|
This rule is triggered for ordered lists that do not either start with '1.' or
|
|
1022
1051
|
do not have a prefix that increases in numerical order (depending on the
|
|
1023
1052
|
configured style). The less-common pattern of using '0.' as a first prefix or
|
|
@@ -1313,6 +1342,8 @@ Aliases: `no-inline-html`
|
|
|
1313
1342
|
Parameters:
|
|
1314
1343
|
|
|
1315
1344
|
- `allowed_elements`: Allowed elements (`string[]`, default `[]`)
|
|
1345
|
+
- `table_allowed_elements`: Allowed elements in tables (`string[]`, default
|
|
1346
|
+
`[]`)
|
|
1316
1347
|
|
|
1317
1348
|
This rule is triggered whenever raw HTML is used in a Markdown document:
|
|
1318
1349
|
|
|
@@ -1326,7 +1357,11 @@ To fix this, use 'pure' Markdown instead of including raw HTML:
|
|
|
1326
1357
|
# Markdown heading
|
|
1327
1358
|
```
|
|
1328
1359
|
|
|
1329
|
-
|
|
1360
|
+
To allow specific HTML elements anywhere in Markdown content, set the
|
|
1361
|
+
`allowed_elements` parameter to a list of HTML element names. To allow a
|
|
1362
|
+
specific set of HTML elements within Markdown tables, set the
|
|
1363
|
+
`table_allowed_elements` parameter to a list of HTML element names. This can be
|
|
1364
|
+
used to permit the use of `<br>`-style line breaks only within Markdown tables.
|
|
1330
1365
|
|
|
1331
1366
|
Rationale: Raw HTML is allowed in Markdown, but this rule is included for
|
|
1332
1367
|
those who want their documents to only include "pure" Markdown, or for those
|
|
@@ -1528,38 +1563,50 @@ Aliases: `no-space-in-code`
|
|
|
1528
1563
|
|
|
1529
1564
|
Fixable: Some violations can be fixed by tooling
|
|
1530
1565
|
|
|
1531
|
-
This rule is triggered for code
|
|
1532
|
-
backticks:
|
|
1566
|
+
This rule is triggered for code spans containing content with unnecessary space
|
|
1567
|
+
next to the beginning or ending backticks:
|
|
1533
1568
|
|
|
1534
1569
|
```markdown
|
|
1535
1570
|
`some text `
|
|
1536
1571
|
|
|
1537
1572
|
` some text`
|
|
1573
|
+
|
|
1574
|
+
` some text `
|
|
1538
1575
|
```
|
|
1539
1576
|
|
|
1540
|
-
To fix this, remove
|
|
1577
|
+
To fix this, remove the extra space characters from the beginning and ending:
|
|
1541
1578
|
|
|
1542
1579
|
```markdown
|
|
1543
1580
|
`some text`
|
|
1544
1581
|
```
|
|
1545
1582
|
|
|
1546
|
-
Note: A single leading and trailing space is allowed by the specification and
|
|
1547
|
-
|
|
1583
|
+
Note: A single leading *and* trailing space is allowed by the specification and
|
|
1584
|
+
trimmed by the parser to support code spans that begin or end with a backtick:
|
|
1548
1585
|
|
|
1549
1586
|
```markdown
|
|
1550
1587
|
`` `backticks` ``
|
|
1588
|
+
|
|
1589
|
+
`` backtick` ``
|
|
1551
1590
|
```
|
|
1552
1591
|
|
|
1553
|
-
Note:
|
|
1554
|
-
|
|
1592
|
+
Note: When single-space padding is present in the input, it will be preserved
|
|
1593
|
+
(even if unnecessary):
|
|
1555
1594
|
|
|
1556
1595
|
```markdown
|
|
1557
|
-
|
|
1596
|
+
` code `
|
|
1558
1597
|
```
|
|
1559
1598
|
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1599
|
+
Note: Code spans containing only spaces are allowed by the specification and are
|
|
1600
|
+
also preserved:
|
|
1601
|
+
|
|
1602
|
+
```markdown
|
|
1603
|
+
` `
|
|
1604
|
+
|
|
1605
|
+
` `
|
|
1606
|
+
```
|
|
1607
|
+
|
|
1608
|
+
Rationale: Violations of this rule are usually unintentional and can lead to
|
|
1609
|
+
improperly-rendered content.
|
|
1563
1610
|
|
|
1564
1611
|
<a name="md039"></a>
|
|
1565
1612
|
|
|
@@ -1650,48 +1697,63 @@ Aliases: `first-line-h1`, `first-line-heading`
|
|
|
1650
1697
|
|
|
1651
1698
|
Parameters:
|
|
1652
1699
|
|
|
1700
|
+
- `allow_preamble`: Allow content before first heading (`boolean`, default
|
|
1701
|
+
`false`)
|
|
1653
1702
|
- `front_matter_title`: RegExp for matching title in front matter (`string`,
|
|
1654
1703
|
default `^\s*title\s*[:=]`)
|
|
1655
1704
|
- `level`: Heading level (`integer`, default `1`)
|
|
1656
1705
|
|
|
1657
1706
|
This rule is intended to ensure documents have a title and is triggered when
|
|
1658
|
-
the first line in
|
|
1707
|
+
the first line in a document is not a top-level ([HTML][HTML] `h1`) heading:
|
|
1659
1708
|
|
|
1660
1709
|
```markdown
|
|
1661
|
-
This is a
|
|
1710
|
+
This is a document without a heading
|
|
1662
1711
|
```
|
|
1663
1712
|
|
|
1664
|
-
To fix this, add a top-level heading to the beginning of the
|
|
1713
|
+
To fix this, add a top-level heading to the beginning of the document:
|
|
1665
1714
|
|
|
1666
1715
|
```markdown
|
|
1667
|
-
#
|
|
1716
|
+
# Document Heading
|
|
1668
1717
|
|
|
1669
|
-
This is a
|
|
1718
|
+
This is a document with a top-level heading
|
|
1670
1719
|
```
|
|
1671
1720
|
|
|
1672
1721
|
Because it is common for projects on GitHub to use an image for the heading of
|
|
1673
|
-
`README.md` and that is not well-supported by Markdown, HTML headings
|
|
1674
|
-
permitted by this rule. For example:
|
|
1722
|
+
`README.md` and that pattern is not well-supported by Markdown, HTML headings
|
|
1723
|
+
are also permitted by this rule. For example:
|
|
1675
1724
|
|
|
1676
1725
|
```markdown
|
|
1677
1726
|
<h1 align="center"><img src="https://placekitten.com/300/150"/></h1>
|
|
1678
1727
|
|
|
1679
|
-
This is a
|
|
1728
|
+
This is a document with a top-level HTML heading
|
|
1680
1729
|
```
|
|
1681
1730
|
|
|
1682
|
-
|
|
1683
|
-
|
|
1731
|
+
In some cases, a document's title heading may be preceded by text like a table
|
|
1732
|
+
of contents. This is not ideal for accessibility, but can be allowed by setting
|
|
1733
|
+
the `allow_preamble` parameter to `true`.
|
|
1684
1734
|
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1735
|
+
```markdown
|
|
1736
|
+
This is a document with preamble text
|
|
1737
|
+
|
|
1738
|
+
# Document Heading
|
|
1739
|
+
```
|
|
1740
|
+
|
|
1741
|
+
If [YAML][YAML] front matter is present and contains a `title` property
|
|
1742
|
+
(commonly used with blog posts), this rule will not report a violation. To use a
|
|
1743
|
+
different property name in the front matter, specify the text of a [regular
|
|
1744
|
+
expression][RegExp] via the `front_matter_title` parameter. To disable the use
|
|
1745
|
+
of front matter by this rule, specify `""` for `front_matter_title`.
|
|
1746
|
+
|
|
1747
|
+
The `level` parameter can be used to change the top-level heading (ex: to `h2`)
|
|
1748
|
+
in cases where an `h1` is added externally.
|
|
1691
1749
|
|
|
1692
1750
|
Rationale: The top-level heading often acts as the title of a document. More
|
|
1693
1751
|
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
|
|
1694
1752
|
|
|
1753
|
+
[HTML]: https://en.wikipedia.org/wiki/HTML
|
|
1754
|
+
[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
|
|
1755
|
+
[YAML]: https://en.wikipedia.org/wiki/YAML
|
|
1756
|
+
|
|
1695
1757
|
<a name="md042"></a>
|
|
1696
1758
|
|
|
1697
1759
|
## `MD042` - No empty links
|
|
@@ -1747,7 +1809,7 @@ structure for a set of files.
|
|
|
1747
1809
|
To require exactly the following structure:
|
|
1748
1810
|
|
|
1749
1811
|
```markdown
|
|
1750
|
-
#
|
|
1812
|
+
# Heading
|
|
1751
1813
|
## Item
|
|
1752
1814
|
### Detail
|
|
1753
1815
|
```
|
|
@@ -1756,7 +1818,7 @@ Set the `headings` parameter to:
|
|
|
1756
1818
|
|
|
1757
1819
|
```json
|
|
1758
1820
|
[
|
|
1759
|
-
"#
|
|
1821
|
+
"# Heading",
|
|
1760
1822
|
"## Item",
|
|
1761
1823
|
"### Detail"
|
|
1762
1824
|
]
|
|
@@ -1765,7 +1827,7 @@ Set the `headings` parameter to:
|
|
|
1765
1827
|
To allow optional headings as with the following structure:
|
|
1766
1828
|
|
|
1767
1829
|
```markdown
|
|
1768
|
-
#
|
|
1830
|
+
# Heading
|
|
1769
1831
|
## Item
|
|
1770
1832
|
### Detail (optional)
|
|
1771
1833
|
## Foot
|
|
@@ -1778,7 +1840,7 @@ special value `"+"` meaning "one or more unspecified headings" and set the
|
|
|
1778
1840
|
|
|
1779
1841
|
```json
|
|
1780
1842
|
[
|
|
1781
|
-
"#
|
|
1843
|
+
"# Heading",
|
|
1782
1844
|
"## Item",
|
|
1783
1845
|
"*",
|
|
1784
1846
|
"## Foot",
|
|
@@ -1786,6 +1848,24 @@ special value `"+"` meaning "one or more unspecified headings" and set the
|
|
|
1786
1848
|
]
|
|
1787
1849
|
```
|
|
1788
1850
|
|
|
1851
|
+
To allow a single required heading to vary as with a project name:
|
|
1852
|
+
|
|
1853
|
+
```markdown
|
|
1854
|
+
# Project Name
|
|
1855
|
+
## Description
|
|
1856
|
+
## Examples
|
|
1857
|
+
```
|
|
1858
|
+
|
|
1859
|
+
Use the special value `"?"` meaning "exactly one unspecified heading":
|
|
1860
|
+
|
|
1861
|
+
```json
|
|
1862
|
+
[
|
|
1863
|
+
"?",
|
|
1864
|
+
"## Description",
|
|
1865
|
+
"## Examples"
|
|
1866
|
+
]
|
|
1867
|
+
```
|
|
1868
|
+
|
|
1789
1869
|
When an error is detected, this rule outputs the line number of the first
|
|
1790
1870
|
problematic heading (otherwise, it outputs the last line number of the file).
|
|
1791
1871
|
|
|
@@ -1855,7 +1935,7 @@ Tags: `accessibility`, `images`
|
|
|
1855
1935
|
|
|
1856
1936
|
Aliases: `no-alt-text`
|
|
1857
1937
|
|
|
1858
|
-
This rule
|
|
1938
|
+
This rule reports a violation when an image is missing alternate text (alt text)
|
|
1859
1939
|
information.
|
|
1860
1940
|
|
|
1861
1941
|
Alternate text is commonly specified inline as:
|
|
@@ -1880,12 +1960,20 @@ Or with HTML as:
|
|
|
1880
1960
|
<img src="image.jpg" alt="Alternate text" />
|
|
1881
1961
|
```
|
|
1882
1962
|
|
|
1963
|
+
Note: If the [HTML `aria-hidden` attribute][aria-hidden] is used to hide the
|
|
1964
|
+
image from assistive technology, this rule does not report a violation:
|
|
1965
|
+
|
|
1966
|
+
```html
|
|
1967
|
+
<img src="image.jpg" aria-hidden="true" />
|
|
1968
|
+
```
|
|
1969
|
+
|
|
1883
1970
|
Guidance for writing alternate text is available from the [W3C][w3c],
|
|
1884
1971
|
[Wikipedia][wikipedia], and [other locations][phase2technology].
|
|
1885
1972
|
|
|
1886
1973
|
Rationale: Alternate text is important for accessibility and describes the
|
|
1887
1974
|
content of an image for people who may not be able to see it.
|
|
1888
1975
|
|
|
1976
|
+
[aria-hidden]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-hidden
|
|
1889
1977
|
[phase2technology]: https://www.phase2technology.com/blog/no-more-excuses
|
|
1890
1978
|
[w3c]: https://www.w3.org/WAI/alt/
|
|
1891
1979
|
[wikipedia]: https://en.wikipedia.org/wiki/Alt_attribute
|
|
@@ -2103,6 +2191,8 @@ Aliases: `link-fragments`
|
|
|
2103
2191
|
Parameters:
|
|
2104
2192
|
|
|
2105
2193
|
- `ignore_case`: Ignore case of fragments (`boolean`, default `false`)
|
|
2194
|
+
- `ignored_pattern`: Pattern for ignoring additional fragments (`string`,
|
|
2195
|
+
default ``)
|
|
2106
2196
|
|
|
2107
2197
|
Fixable: Some violations can be fixed by tooling
|
|
2108
2198
|
|
|
@@ -2160,6 +2250,13 @@ attribute can be used to define a fragment:
|
|
|
2160
2250
|
An `a` tag can be useful in scenarios where a heading is not appropriate or for
|
|
2161
2251
|
control over the text of the fragment identifier.
|
|
2162
2252
|
|
|
2253
|
+
[HTML links to `#top` scroll to the top of a document][html-top-fragment]. This
|
|
2254
|
+
rule allows that syntax (using lower-case for consistency):
|
|
2255
|
+
|
|
2256
|
+
```markdown
|
|
2257
|
+
[Link](#top)
|
|
2258
|
+
```
|
|
2259
|
+
|
|
2163
2260
|
This rule also recognizes the custom fragment syntax used by GitHub to highlight
|
|
2164
2261
|
[specific content in a document][github-linking-to-content].
|
|
2165
2262
|
|
|
@@ -2175,6 +2272,12 @@ And this link to content starting within line 19 running into line 21:
|
|
|
2175
2272
|
[Link](#L19C5-L21C11)
|
|
2176
2273
|
```
|
|
2177
2274
|
|
|
2275
|
+
Some Markdown generators dynamically create and insert headings when building
|
|
2276
|
+
documents, for example by combining a fixed prefix like `figure-` and an
|
|
2277
|
+
incrementing numeric counter. To ignore such generated fragments, set the
|
|
2278
|
+
`ignored_pattern` [regular expression][RegEx] parameter to a pattern that
|
|
2279
|
+
matches (e.g., `^figure-`).
|
|
2280
|
+
|
|
2178
2281
|
Rationale: [GitHub section links][github-section-links] are created
|
|
2179
2282
|
automatically for every heading when Markdown content is displayed on GitHub.
|
|
2180
2283
|
This makes it easy to link directly to different sections within a document.
|
|
@@ -2189,6 +2292,8 @@ append an incrementing integer as needed for uniqueness.
|
|
|
2189
2292
|
[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
|
|
2190
2293
|
[github-heading-algorithm]: https://github.com/gjtorikian/html-pipeline/blob/f13a1534cb650ba17af400d1acd3a22c28004c09/lib/html/pipeline/toc_filter.rb
|
|
2191
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#linking-to-markdown
|
|
2295
|
+
[html-top-fragment]: https://html.spec.whatwg.org/multipage/browsing-the-web.html#scrolling-to-a-fragment
|
|
2296
|
+
[RegEx]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
|
|
2192
2297
|
|
|
2193
2298
|
<a name="md052"></a>
|
|
2194
2299
|
|
|
@@ -2200,6 +2305,7 @@ Aliases: `reference-links-images`
|
|
|
2200
2305
|
|
|
2201
2306
|
Parameters:
|
|
2202
2307
|
|
|
2308
|
+
- `ignored_labels`: Ignored link labels (`string[]`, default `["x"]`)
|
|
2203
2309
|
- `shortcut_syntax`: Include shortcut syntax (`boolean`, default `false`)
|
|
2204
2310
|
|
|
2205
2311
|
Links and images in Markdown can provide the link destination or image source
|
|
@@ -2233,6 +2339,17 @@ the `include_shortcut` parameter to `true`. Note that doing so produces warnings
|
|
|
2233
2339
|
for *all* text in the document that *could* be a shortcut. If bracketed text is
|
|
2234
2340
|
intentional, brackets can be escaped with the `\` character: `\[example\]`.
|
|
2235
2341
|
|
|
2342
|
+
If there are link labels that are deliberately unreferenced, they can be ignored
|
|
2343
|
+
by setting the `ignored_labels` parameter to the list of strings to ignore. The
|
|
2344
|
+
default value of this parameter ignores the checkbox syntax used by
|
|
2345
|
+
[GitHub Flavored Markdown task list items][gfm-tasklist]:
|
|
2346
|
+
|
|
2347
|
+
```markdown
|
|
2348
|
+
- [x] Checked task list item
|
|
2349
|
+
```
|
|
2350
|
+
|
|
2351
|
+
[gfm-tasklist]: https://github.github.com/gfm/#task-list-items-extension-
|
|
2352
|
+
|
|
2236
2353
|
<a name="md053"></a>
|
|
2237
2354
|
|
|
2238
2355
|
## `MD053` - Link and image reference definitions should be needed
|
|
@@ -2266,9 +2383,9 @@ reference has the corresponding label. The "full", "collapsed", and "shortcut"
|
|
|
2266
2383
|
formats are all supported.
|
|
2267
2384
|
|
|
2268
2385
|
If there are reference definitions that are deliberately unreferenced, they can
|
|
2269
|
-
be ignored by setting the `ignored_definitions` parameter
|
|
2270
|
-
this parameter ignores the following convention
|
|
2271
|
-
Markdown:
|
|
2386
|
+
be ignored by setting the `ignored_definitions` parameter to the list of strings
|
|
2387
|
+
to ignore. The default value of this parameter ignores the following convention
|
|
2388
|
+
for adding non-HTML comments to Markdown:
|
|
2272
2389
|
|
|
2273
2390
|
```markdown
|
|
2274
2391
|
[//]: # (This behaves like a comment)
|
|
@@ -2433,7 +2550,7 @@ Rationale: Some parsers have difficulty with tables that are missing their
|
|
|
2433
2550
|
leading or trailing pipe characters. The use of leading/trailing pipes can also
|
|
2434
2551
|
help provide visual clarity.
|
|
2435
2552
|
|
|
2436
|
-
[gfm-table-055]: https://
|
|
2553
|
+
[gfm-table-055]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|
|
2437
2554
|
|
|
2438
2555
|
<a name="md056"></a>
|
|
2439
2556
|
|
|
@@ -2473,7 +2590,7 @@ of cells or it will not be recognized as a table (per specification).
|
|
|
2473
2590
|
Rationale: Extra cells in a row are usually not shown, so their data is lost.
|
|
2474
2591
|
Missing cells in a row create holes in the table and suggest an omission.
|
|
2475
2592
|
|
|
2476
|
-
[gfm-table-056]: https://
|
|
2593
|
+
[gfm-table-056]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|
|
2477
2594
|
|
|
2478
2595
|
<a name="md058"></a>
|
|
2479
2596
|
|
|
@@ -2526,6 +2643,115 @@ Some text
|
|
|
2526
2643
|
Rationale: In addition to aesthetic reasons, some parsers will incorrectly parse
|
|
2527
2644
|
tables that don't have blank lines before and after them.
|
|
2528
2645
|
|
|
2646
|
+
<a name="md059"></a>
|
|
2647
|
+
|
|
2648
|
+
## `MD059` - Link text should be descriptive
|
|
2649
|
+
|
|
2650
|
+
Tags: `accessibility`, `links`
|
|
2651
|
+
|
|
2652
|
+
Aliases: `descriptive-link-text`
|
|
2653
|
+
|
|
2654
|
+
Parameters:
|
|
2655
|
+
|
|
2656
|
+
- `prohibited_texts`: Prohibited link texts (`string[]`, default `["click
|
|
2657
|
+
here","here","link","more"]`)
|
|
2658
|
+
|
|
2659
|
+
This rule is triggered when a link has generic text like `[click here](...)` or
|
|
2660
|
+
`[link](...)`.
|
|
2661
|
+
|
|
2662
|
+
Link text should be descriptive and communicate the purpose of the link (e.g.,
|
|
2663
|
+
`[Download the budget document](...)` or `[CommonMark Specification](...)`).
|
|
2664
|
+
This is especially important for screen readers which sometimes present links
|
|
2665
|
+
without context.
|
|
2666
|
+
|
|
2667
|
+
By default, this rule prohibits a small number of common English words/phrases.
|
|
2668
|
+
To customize that list of words/phrases, set the `prohibited_texts` parameter to
|
|
2669
|
+
an `Array` of `string`s.
|
|
2670
|
+
|
|
2671
|
+
Note: For languages other than English, use the `prohibited_texts` parameter to
|
|
2672
|
+
customize the list for that language. It is *not* a goal for this rule to have
|
|
2673
|
+
translations for every language.
|
|
2674
|
+
|
|
2675
|
+
Note: This rule checks Markdown links; HTML links are ignored.
|
|
2676
|
+
|
|
2677
|
+
More information:
|
|
2678
|
+
|
|
2679
|
+
- <https://webaim.org/techniques/hypertext/>
|
|
2680
|
+
- <https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-link-only.html>
|
|
2681
|
+
|
|
2682
|
+
<a name="md060"></a>
|
|
2683
|
+
|
|
2684
|
+
## `MD060` - Table column style
|
|
2685
|
+
|
|
2686
|
+
Tags: `table`
|
|
2687
|
+
|
|
2688
|
+
Aliases: `table-column-style`
|
|
2689
|
+
|
|
2690
|
+
Parameters:
|
|
2691
|
+
|
|
2692
|
+
- `style`: Table column style (`string`, default `any`, values `aligned` /
|
|
2693
|
+
`any` / `compact` / `tight`)
|
|
2694
|
+
|
|
2695
|
+
This rule is triggered when the column separators of a
|
|
2696
|
+
[GitHub Flavored Markdown table][gfm-table-060] are used inconsistently.
|
|
2697
|
+
|
|
2698
|
+
This rule recognizes three table column styles based on popular use:
|
|
2699
|
+
|
|
2700
|
+
Style `aligned` looks the most like a table:
|
|
2701
|
+
|
|
2702
|
+
```markdown
|
|
2703
|
+
| Character | Meaning |
|
|
2704
|
+
| --------- | ------- |
|
|
2705
|
+
| Y | Yes |
|
|
2706
|
+
| N | No |
|
|
2707
|
+
```
|
|
2708
|
+
|
|
2709
|
+
Style `compact` uses a single space to pad cell content:
|
|
2710
|
+
|
|
2711
|
+
```markdown
|
|
2712
|
+
| Character | Meaning |
|
|
2713
|
+
| --- | --- |
|
|
2714
|
+
| Y | Yes |
|
|
2715
|
+
| N | No |
|
|
2716
|
+
```
|
|
2717
|
+
|
|
2718
|
+
Style `tight` uses no padding for cell content:
|
|
2719
|
+
|
|
2720
|
+
```markdown
|
|
2721
|
+
|Character|Meaning|
|
|
2722
|
+
|---|---|
|
|
2723
|
+
|Y|Yes|
|
|
2724
|
+
|N|No|
|
|
2725
|
+
```
|
|
2726
|
+
|
|
2727
|
+
When this rule's `style` parameter is set to `aligned`, `compact`, or `tight`,
|
|
2728
|
+
every table must match the corresponding pattern and errors will be reported for
|
|
2729
|
+
any violations. By default, or when the `any` style is used, each table is
|
|
2730
|
+
analyzed to see if it satisfies any supported style. If so, no errors are
|
|
2731
|
+
reported. If not, errors are be reported for whichever style would produce the
|
|
2732
|
+
*fewest* errors (i.e., whichever style is the closest match).
|
|
2733
|
+
|
|
2734
|
+
Note: Pipe alignment for the `aligned` style is based on character count, so
|
|
2735
|
+
wide characters and multi-character encodings can produce unexpected results.
|
|
2736
|
+
The following table is correctly aligned based on character count, though some
|
|
2737
|
+
editors render the emoji wider:
|
|
2738
|
+
|
|
2739
|
+
<!-- markdownlint-capture -->
|
|
2740
|
+
<!-- markdownlint-disable extended-ascii -->
|
|
2741
|
+
|
|
2742
|
+
```markdown
|
|
2743
|
+
| Response | Emoji |
|
|
2744
|
+
| -------- | ----- |
|
|
2745
|
+
| Yes | ✅ |
|
|
2746
|
+
| No | ❎ |
|
|
2747
|
+
```
|
|
2748
|
+
|
|
2749
|
+
<!-- markdownlint-restore -->
|
|
2750
|
+
|
|
2751
|
+
Rationale: Consistent formatting makes it easier to understand a document.
|
|
2752
|
+
|
|
2753
|
+
[gfm-table-060]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|
|
2754
|
+
|
|
2529
2755
|
<!-- markdownlint-configure-file {
|
|
2530
2756
|
"no-inline-html": {
|
|
2531
2757
|
"allowed_elements": [
|
package/doc/md001.md
CHANGED
|
@@ -4,6 +4,11 @@ Tags: `headings`
|
|
|
4
4
|
|
|
5
5
|
Aliases: `heading-increment`
|
|
6
6
|
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `front_matter_title`: RegExp for matching title in front matter (`string`,
|
|
10
|
+
default `^\s*title\s*[:=]`)
|
|
11
|
+
|
|
7
12
|
This rule is triggered when you skip heading levels in a Markdown document, for
|
|
8
13
|
example:
|
|
9
14
|
|
|
@@ -32,6 +37,15 @@ level at a time:
|
|
|
32
37
|
### Another Heading 3
|
|
33
38
|
```
|
|
34
39
|
|
|
40
|
+
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
|
|
41
|
+
contains a `title` property (commonly used with blog posts), this rule treats
|
|
42
|
+
that as a top level heading and will report a violation if the actual first
|
|
43
|
+
heading is not a level 2 heading. To use a different property name in the
|
|
44
|
+
front matter, specify the text of a regular expression via the
|
|
45
|
+
`front_matter_title` parameter. To disable the use of front matter by this
|
|
46
|
+
rule, specify `""` for `front_matter_title`. When front matter is not present,
|
|
47
|
+
the first heading can be any level.
|
|
48
|
+
|
|
35
49
|
Rationale: Headings represent the structure of a document and can be confusing
|
|
36
50
|
when skipped - especially for accessibility scenarios. More information:
|
|
37
51
|
<https://www.w3.org/WAI/tutorials/page-structure/headings/>.
|
package/doc/md009.md
CHANGED
|
@@ -7,6 +7,7 @@ Aliases: `no-trailing-spaces`
|
|
|
7
7
|
Parameters:
|
|
8
8
|
|
|
9
9
|
- `br_spaces`: Spaces for line break (`integer`, default `2`)
|
|
10
|
+
- `code_blocks`: Include code blocks (`boolean`, default `false`)
|
|
10
11
|
- `list_item_empty_lines`: Allow spaces for empty lines in list items
|
|
11
12
|
(`boolean`, default `false`)
|
|
12
13
|
- `strict`: Include unnecessary breaks (`boolean`, default `false`)
|
|
@@ -16,21 +17,19 @@ Fixable: Some violations can be fixed by tooling
|
|
|
16
17
|
This rule is triggered on any lines that end with unexpected whitespace. To fix
|
|
17
18
|
this, remove the trailing space from the end of the line.
|
|
18
19
|
|
|
19
|
-
Note: Trailing space is allowed in indented and fenced code blocks because some
|
|
20
|
-
languages require it.
|
|
21
|
-
|
|
22
20
|
The `br_spaces` parameter allows an exception to this rule for a specific number
|
|
23
21
|
of trailing spaces, typically used to insert an explicit line break. The default
|
|
24
|
-
value allows 2 spaces to indicate a hard break (\<br> element).
|
|
22
|
+
value allows 2 spaces to indicate a hard break (\<br> element). (You must set
|
|
23
|
+
`br_spaces` to a value >= 2 for this parameter to take effect. Setting
|
|
24
|
+
`br_spaces` to 1 behaves the same as 0, disallowing any trailing spaces.)
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
By default, trailing space is allowed in indented and fenced code blocks because
|
|
27
|
+
some programming languages require that. To report such instances, set the
|
|
28
|
+
`code_blocks` parameter to `true`.
|
|
29
29
|
|
|
30
30
|
By default, this rule will not trigger when the allowed number of spaces is
|
|
31
31
|
used, even when it doesn't create a hard break (for example, at the end of a
|
|
32
|
-
paragraph). To report such instances
|
|
33
|
-
`true`.
|
|
32
|
+
paragraph). To report such instances, set the `strict` parameter to `true`.
|
|
34
33
|
|
|
35
34
|
```markdown
|
|
36
35
|
Text text text
|
package/doc/md010.md
CHANGED
|
@@ -54,3 +54,9 @@ parameter to the desired value.
|
|
|
54
54
|
|
|
55
55
|
Rationale: Hard tabs are often rendered inconsistently by different editors and
|
|
56
56
|
can be harder to work with than spaces.
|
|
57
|
+
|
|
58
|
+
More information:
|
|
59
|
+
|
|
60
|
+
- <https://agiletribe.wordpress.com/2011/10/27/18-dont-use-tab-characters/>
|
|
61
|
+
- <https://www.jwz.org/doc/tabs-vs-spaces.html>
|
|
62
|
+
- <https://adamspiers.org/computing/why_no_tabs.html>
|
package/doc/md027.md
CHANGED
|
@@ -4,6 +4,10 @@ Tags: `blockquote`, `indentation`, `whitespace`
|
|
|
4
4
|
|
|
5
5
|
Aliases: `no-multiple-space-blockquote`
|
|
6
6
|
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `list_items`: Include list items (`boolean`, default `true`)
|
|
10
|
+
|
|
7
11
|
Fixable: Some violations can be fixed by tooling
|
|
8
12
|
|
|
9
13
|
This rule is triggered when blockquotes have more than one space after the
|
|
@@ -21,4 +25,8 @@ To fix, remove any extraneous space:
|
|
|
21
25
|
> indentation.
|
|
22
26
|
```
|
|
23
27
|
|
|
28
|
+
Inferring intended list indentation within a blockquote can be challenging;
|
|
29
|
+
setting the `list_items` parameter to `false` disables this rule for ordered
|
|
30
|
+
and unordered list items.
|
|
31
|
+
|
|
24
32
|
Rationale: Consistent formatting makes it easier to understand a document.
|
package/doc/md029.md
CHANGED
|
@@ -9,6 +9,8 @@ Parameters:
|
|
|
9
9
|
- `style`: List style (`string`, default `one_or_ordered`, values `one` /
|
|
10
10
|
`one_or_ordered` / `ordered` / `zero`)
|
|
11
11
|
|
|
12
|
+
Fixable: Some violations can be fixed by tooling
|
|
13
|
+
|
|
12
14
|
This rule is triggered for ordered lists that do not either start with '1.' or
|
|
13
15
|
do not have a prefix that increases in numerical order (depending on the
|
|
14
16
|
configured style). The less-common pattern of using '0.' as a first prefix or
|