markdownlint 0.25.0 → 0.26.1
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/CONTRIBUTING.md +2 -0
- package/LICENSE +1 -1
- package/README.md +125 -83
- package/demo/markdownlint-browser.js +1719 -1269
- package/doc/Rules.md +133 -15
- package/helpers/LICENSE +1 -1
- package/helpers/helpers.js +427 -192
- package/helpers/package.json +6 -2
- package/lib/cache.js +15 -25
- package/lib/constants.js +1 -1
- package/lib/markdownlint.d.ts +21 -17
- package/lib/markdownlint.js +237 -146
- package/lib/md004.js +4 -4
- package/lib/md005.js +4 -4
- package/lib/md006.js +4 -4
- package/lib/md007.js +4 -4
- package/lib/md009.js +20 -13
- package/lib/md010.js +15 -2
- package/lib/md011.js +2 -2
- package/lib/md013.js +4 -5
- package/lib/md014.js +4 -4
- package/lib/md021.js +3 -1
- package/lib/md026.js +1 -1
- package/lib/md027.js +2 -2
- package/lib/md028.js +2 -2
- package/lib/md029.js +5 -4
- package/lib/md030.js +4 -4
- package/lib/md031.js +2 -2
- package/lib/md032.js +3 -2
- package/lib/md033.js +2 -3
- package/lib/md034.js +2 -2
- package/lib/md035.js +7 -2
- package/lib/md036.js +2 -2
- package/lib/md038.js +7 -4
- package/lib/md039.js +6 -4
- package/lib/md042.js +17 -10
- package/lib/md043.js +2 -2
- package/lib/md044.js +20 -9
- package/lib/md046.js +14 -13
- package/lib/md048.js +13 -14
- package/lib/md049-md050.js +73 -0
- package/lib/md051.js +87 -0
- package/lib/md052.js +35 -0
- package/lib/md053.js +52 -0
- package/lib/rules.js +6 -4
- package/package.json +36 -29
- package/schema/.markdownlint.jsonc +15 -2
- package/schema/.markdownlint.yaml +14 -1
- package/schema/markdownlint-config-schema.json +119 -737
- package/lib/md049.js +0 -45
- package/lib/md050.js +0 -45
package/doc/Rules.md
CHANGED
|
@@ -13,7 +13,7 @@ Tags: headings, headers
|
|
|
13
13
|
|
|
14
14
|
Aliases: heading-increment, header-increment
|
|
15
15
|
|
|
16
|
-
This rule is triggered when you skip heading levels in a
|
|
16
|
+
This rule is triggered when you skip heading levels in a Markdown document, for
|
|
17
17
|
example:
|
|
18
18
|
|
|
19
19
|
```markdown
|
|
@@ -331,7 +331,7 @@ Rationale: Indenting by 2 spaces allows the content of a nested list to be in
|
|
|
331
331
|
line with the start of the content of the parent list when a single space is
|
|
332
332
|
used after the list marker. Indenting by 4 spaces is consistent with code blocks
|
|
333
333
|
and simpler for editors to implement. Additionally, this can be a compatibility
|
|
334
|
-
issue for
|
|
334
|
+
issue for other Markdown parsers, which require 4-space indents. More information:
|
|
335
335
|
<https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists>
|
|
336
336
|
and <http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting>.
|
|
337
337
|
|
|
@@ -396,7 +396,7 @@ Tags: whitespace, hard_tab
|
|
|
396
396
|
|
|
397
397
|
Aliases: no-hard-tabs
|
|
398
398
|
|
|
399
|
-
Parameters: code_blocks, spaces_per_tab (boolean; default true, number; default 1)
|
|
399
|
+
Parameters: code_blocks, ignore_code_languages, spaces_per_tab (boolean; default true, array of string; default empty, number; default 1)
|
|
400
400
|
|
|
401
401
|
Fixable: Most violations can be fixed by tooling
|
|
402
402
|
|
|
@@ -429,6 +429,12 @@ set the `code_blocks` parameter to `false`. Code blocks and spans are included
|
|
|
429
429
|
by default since handling of tabs by Markdown tools can be inconsistent (e.g.,
|
|
430
430
|
using 4 vs. 8 spaces).
|
|
431
431
|
|
|
432
|
+
When code blocks are scanned (e.g., by default or if `code_blocks` is `true`),
|
|
433
|
+
the `ignore_code_languages` parameter can be set to a list of languages that
|
|
434
|
+
should be ignored (i.e., hard tabs will be allowed, though not required). This
|
|
435
|
+
makes it easier for documents to include code for languages that require hard
|
|
436
|
+
tabs.
|
|
437
|
+
|
|
432
438
|
By default, violations of this rule are fixed by replacing the tab with 1 space
|
|
433
439
|
character. To use a different number of spaces, set the `spaces_per_tab`
|
|
434
440
|
parameter to the desired value.
|
|
@@ -861,7 +867,7 @@ in changelogs):
|
|
|
861
867
|
### Features
|
|
862
868
|
```
|
|
863
869
|
|
|
864
|
-
Rationale: Some
|
|
870
|
+
Rationale: Some Markdown parsers generate anchors for headings based on the
|
|
865
871
|
heading name; headings with the same content can cause problems with that.
|
|
866
872
|
|
|
867
873
|
<a name="md025"></a>
|
|
@@ -1016,7 +1022,7 @@ blockquote symbol at the beginning of the blank line:
|
|
|
1016
1022
|
> This is the same blockquote.
|
|
1017
1023
|
```
|
|
1018
1024
|
|
|
1019
|
-
Rationale: Some
|
|
1025
|
+
Rationale: Some Markdown parsers will treat two blockquotes separated by one
|
|
1020
1026
|
or more blank lines as the same blockquote, while others will treat them as
|
|
1021
1027
|
separate blockquotes.
|
|
1022
1028
|
|
|
@@ -1297,13 +1303,13 @@ Aliases: no-inline-html
|
|
|
1297
1303
|
|
|
1298
1304
|
Parameters: allowed_elements (array of string; default empty)
|
|
1299
1305
|
|
|
1300
|
-
This rule is triggered whenever raw HTML is used in a
|
|
1306
|
+
This rule is triggered whenever raw HTML is used in a Markdown document:
|
|
1301
1307
|
|
|
1302
1308
|
```markdown
|
|
1303
1309
|
<h1>Inline HTML heading</h1>
|
|
1304
1310
|
```
|
|
1305
1311
|
|
|
1306
|
-
To fix this, use 'pure'
|
|
1312
|
+
To fix this, use 'pure' Markdown instead of including raw HTML:
|
|
1307
1313
|
|
|
1308
1314
|
```markdown
|
|
1309
1315
|
# Markdown heading
|
|
@@ -1311,9 +1317,9 @@ To fix this, use 'pure' markdown instead of including raw HTML:
|
|
|
1311
1317
|
|
|
1312
1318
|
Note: To allow specific HTML elements, use the 'allowed_elements' parameter.
|
|
1313
1319
|
|
|
1314
|
-
Rationale: Raw HTML is allowed in
|
|
1315
|
-
those who want their documents to only include "pure"
|
|
1316
|
-
who are rendering
|
|
1320
|
+
Rationale: Raw HTML is allowed in Markdown, but this rule is included for
|
|
1321
|
+
those who want their documents to only include "pure" Markdown, or for those
|
|
1322
|
+
who are rendering Markdown documents into something other than HTML.
|
|
1317
1323
|
|
|
1318
1324
|
<a name="md034"></a>
|
|
1319
1325
|
|
|
@@ -1339,7 +1345,7 @@ For more information, see <https://www.example.com/>.
|
|
|
1339
1345
|
```
|
|
1340
1346
|
|
|
1341
1347
|
Note: To use a bare URL without it being converted into a link, enclose it in
|
|
1342
|
-
a code block, otherwise in some
|
|
1348
|
+
a code block, otherwise in some Markdown parsers it *will* be converted:
|
|
1343
1349
|
|
|
1344
1350
|
```markdown
|
|
1345
1351
|
`https://www.example.com`
|
|
@@ -1360,7 +1366,7 @@ The use of quotes around a bare link will *not* trigger this rule, either:
|
|
|
1360
1366
|
```
|
|
1361
1367
|
|
|
1362
1368
|
Rationale: Without angle brackets, the URL isn't converted into a link by many
|
|
1363
|
-
|
|
1369
|
+
Markdown parsers.
|
|
1364
1370
|
|
|
1365
1371
|
<a name="md035"></a>
|
|
1366
1372
|
|
|
@@ -1429,7 +1435,7 @@ _Another section_
|
|
|
1429
1435
|
Consectetur adipiscing elit, sed do eiusmod.
|
|
1430
1436
|
```
|
|
1431
1437
|
|
|
1432
|
-
To fix this, use
|
|
1438
|
+
To fix this, use Markdown headings instead of emphasized text to denote
|
|
1433
1439
|
sections:
|
|
1434
1440
|
|
|
1435
1441
|
```markdown
|
|
@@ -1752,7 +1758,7 @@ Tags: spelling
|
|
|
1752
1758
|
|
|
1753
1759
|
Aliases: proper-names
|
|
1754
1760
|
|
|
1755
|
-
Parameters: names, code_blocks (string array; default `null`, boolean; default `true`)
|
|
1761
|
+
Parameters: names, code_blocks, html_elements (string array; default `null`, boolean; default `true`, boolean; default `true`)
|
|
1756
1762
|
|
|
1757
1763
|
Fixable: Most violations can be fixed by tooling
|
|
1758
1764
|
|
|
@@ -1771,7 +1777,9 @@ the proper capitalization, specify the desired letter case in the `names` array:
|
|
|
1771
1777
|
```
|
|
1772
1778
|
|
|
1773
1779
|
Set the `code_blocks` parameter to `false` to disable this rule for code blocks
|
|
1774
|
-
and spans.
|
|
1780
|
+
and spans. Set the `html_elements` parameter to `false` to disable this rule
|
|
1781
|
+
for HTML elements and attributes (such as when using a proper name as part of
|
|
1782
|
+
a path for `a`/`href` or `img`/`src`).
|
|
1775
1783
|
|
|
1776
1784
|
Rationale: Incorrect capitalization of proper names is usually a mistake.
|
|
1777
1785
|
|
|
@@ -1984,3 +1992,113 @@ The configured strong style can be a specific symbol to use ("asterisk",
|
|
|
1984
1992
|
"underscore"), or can require that usage be consistent within the document.
|
|
1985
1993
|
|
|
1986
1994
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1995
|
+
|
|
1996
|
+
<a name="md051"></a>
|
|
1997
|
+
|
|
1998
|
+
## MD051 - Link fragments should be valid
|
|
1999
|
+
|
|
2000
|
+
Tags: links
|
|
2001
|
+
|
|
2002
|
+
Aliases: link-fragments
|
|
2003
|
+
|
|
2004
|
+
This rule is triggered when a link fragment does not correspond to a heading
|
|
2005
|
+
in the document:
|
|
2006
|
+
|
|
2007
|
+
```markdown
|
|
2008
|
+
# Title
|
|
2009
|
+
|
|
2010
|
+
[Link](#fragment)
|
|
2011
|
+
```
|
|
2012
|
+
|
|
2013
|
+
To fix the issue, change the fragment to reference an existing heading:
|
|
2014
|
+
|
|
2015
|
+
```markdown
|
|
2016
|
+
[Link](#title)
|
|
2017
|
+
```
|
|
2018
|
+
|
|
2019
|
+
Alternatively, an HTML `a` tag with an `id` (or a `name`) attribute defines a
|
|
2020
|
+
valid anchor:
|
|
2021
|
+
|
|
2022
|
+
```markdown
|
|
2023
|
+
<a id="fragment"></a>
|
|
2024
|
+
```
|
|
2025
|
+
|
|
2026
|
+
Some platforms (e.g., [GitHub][github-section-links]) automatically create HTML
|
|
2027
|
+
anchors for every heading. This makes it easy to link to different sections in
|
|
2028
|
+
a document. These internal links can break over time as headings are renamed.
|
|
2029
|
+
|
|
2030
|
+
Note: Creating anchors for headings is not part of the CommonMark specification.
|
|
2031
|
+
|
|
2032
|
+
[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
|
|
2033
|
+
|
|
2034
|
+
<a name="md052"></a>
|
|
2035
|
+
|
|
2036
|
+
## MD052 - Reference links and images should use a label that is defined
|
|
2037
|
+
|
|
2038
|
+
Tags: images, links
|
|
2039
|
+
|
|
2040
|
+
Aliases: reference-links-images
|
|
2041
|
+
|
|
2042
|
+
Links and images in Markdown can provide the link destination or image source
|
|
2043
|
+
at the time of use or can define it elsewhere and use a label for reference.
|
|
2044
|
+
The reference format is convenient for keeping paragraph text clutter-free
|
|
2045
|
+
and makes it easy to reuse the same URL in multiple places.
|
|
2046
|
+
|
|
2047
|
+
There are three kinds of reference links and images:
|
|
2048
|
+
|
|
2049
|
+
```markdown
|
|
2050
|
+
Full: [text][label]
|
|
2051
|
+
Collapsed: [label][]
|
|
2052
|
+
Shortcut: [label]
|
|
2053
|
+
|
|
2054
|
+
Full: ![text][image]
|
|
2055
|
+
Collapsed: ![image][]
|
|
2056
|
+
Shortcut: ![image]
|
|
2057
|
+
|
|
2058
|
+
[label]: https://example.com/label
|
|
2059
|
+
[image]: https://example.com/image
|
|
2060
|
+
```
|
|
2061
|
+
|
|
2062
|
+
A link or image renders correctly when a corresponding label is defined, but
|
|
2063
|
+
the text displays with brackets if the label is not present. This rule warns
|
|
2064
|
+
of undefined labels for "full" and "collapsed" reference syntax.
|
|
2065
|
+
|
|
2066
|
+
> "Shortcut" syntax is ambiguous and a missing label will not generate an
|
|
2067
|
+
error. For example, `[shortcut]` could be a shortcut link or the text
|
|
2068
|
+
"shortcut" in brackets.
|
|
2069
|
+
|
|
2070
|
+
<a name="md053"></a>
|
|
2071
|
+
|
|
2072
|
+
## MD053 - Link and image reference definitions should be needed
|
|
2073
|
+
|
|
2074
|
+
Tags: images, links
|
|
2075
|
+
|
|
2076
|
+
Aliases: link-image-reference-definitions
|
|
2077
|
+
|
|
2078
|
+
Fixable: Most violations can be fixed by tooling
|
|
2079
|
+
|
|
2080
|
+
Links and images in Markdown can provide the link destination or image source
|
|
2081
|
+
at the time of use or can define it elsewhere and use a label for reference.
|
|
2082
|
+
The reference format is convenient for keeping paragraph text clutter-free
|
|
2083
|
+
and makes it easy to reuse the same URL in multiple places.
|
|
2084
|
+
|
|
2085
|
+
Because link and image reference definitions are located separately from
|
|
2086
|
+
where they are used, there are two scenarios where a definition can be
|
|
2087
|
+
unnecessary:
|
|
2088
|
+
|
|
2089
|
+
1. If a label is not referenced by any link or image in a document, that
|
|
2090
|
+
definition is unused and can be deleted.
|
|
2091
|
+
1. If a label is defined multiple times in a document, the first definition is
|
|
2092
|
+
used and the others can be deleted.
|
|
2093
|
+
|
|
2094
|
+
This rule considers a reference definition to be used if any link or image
|
|
2095
|
+
reference has the corresponding label. "Full", "collapsed", and "shortcut"
|
|
2096
|
+
formats are all supported.
|
|
2097
|
+
|
|
2098
|
+
<!-- markdownlint-configure-file {
|
|
2099
|
+
"no-inline-html": {
|
|
2100
|
+
"allowed_elements": [
|
|
2101
|
+
"a"
|
|
2102
|
+
]
|
|
2103
|
+
}
|
|
2104
|
+
} -->
|
package/helpers/LICENSE
CHANGED