markdownlint 0.31.0 → 0.32.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 +16 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +19 -28
- package/demo/markdownlint-browser.js +506 -335
- package/doc/Rules.md +178 -144
- package/doc/md001.md +2 -2
- package/doc/md003.md +2 -2
- package/doc/md007.md +4 -7
- package/doc/md013.md +0 -3
- package/doc/md018.md +1 -1
- package/doc/md019.md +1 -1
- package/doc/md020.md +1 -1
- package/doc/md021.md +1 -1
- package/doc/md022.md +2 -2
- package/doc/md023.md +9 -2
- package/doc/md024.md +2 -2
- package/doc/md025.md +1 -1
- package/doc/md026.md +1 -1
- package/doc/md032.md +31 -14
- package/doc/md036.md +2 -2
- package/doc/md041.md +1 -1
- package/doc/md043.md +2 -5
- package/doc/md045.md +6 -0
- package/doc/md049.md +1 -1
- package/doc/md050.md +1 -1
- package/doc/md053.md +3 -3
- package/doc/md054.md +100 -0
- package/helpers/helpers.js +27 -7
- package/helpers/micromark.cjs +62 -15
- package/helpers/package.json +3 -2
- package/helpers/shared.js +3 -0
- package/lib/configuration.d.ts +1152 -0
- package/lib/constants.js +7 -7
- package/lib/markdownlint.d.ts +2 -4
- package/lib/markdownlint.js +9 -8
- package/lib/md001.js +2 -2
- package/lib/md003.js +2 -2
- package/lib/md005.js +21 -17
- package/lib/md007.js +62 -25
- package/lib/md013.js +1 -4
- package/lib/md018.js +1 -1
- package/lib/md019.js +1 -1
- package/lib/md020.js +1 -1
- package/lib/md021.js +1 -1
- package/lib/md022.js +4 -4
- package/lib/md023.js +2 -2
- package/lib/md024.js +2 -2
- package/lib/md025.js +1 -1
- package/lib/md026.js +1 -1
- package/lib/md030.js +33 -22
- package/lib/md032.js +1 -4
- package/lib/md033.js +1 -3
- package/lib/md034.js +12 -8
- package/lib/md036.js +2 -2
- package/lib/md037.js +2 -2
- package/lib/md038.js +7 -5
- package/lib/md041.js +1 -1
- package/lib/md043.js +3 -3
- package/lib/md045.js +33 -3
- package/lib/md049-md050.js +2 -2
- package/lib/md051.js +8 -6
- package/lib/md053.js +1 -1
- package/lib/md054.js +118 -0
- package/lib/rules.js +5 -3
- package/package.json +19 -17
- package/schema/.markdownlint.jsonc +63 -60
- package/schema/.markdownlint.yaml +62 -59
- package/schema/markdownlint-config-schema.json +840 -186
- package/style/relaxed.json +0 -1
- package/doc/md002.md +0 -37
- package/doc/md006.md +0 -46
- package/lib/md002.js +0 -22
- package/lib/md006.js +0 -34
package/doc/Rules.md
CHANGED
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
This document contains a description of all rules, what they are checking for,
|
|
4
4
|
as well as examples of documents that break the rule and corrected
|
|
5
|
-
versions of the examples.
|
|
6
|
-
deprecated, but still provided for backward-compatibility.
|
|
5
|
+
versions of the examples.
|
|
7
6
|
|
|
8
7
|
<a name="md001"></a>
|
|
9
8
|
|
|
10
9
|
## `MD001` - Heading levels should only increment by one level at a time
|
|
11
10
|
|
|
12
|
-
Tags: `
|
|
11
|
+
Tags: `headings`
|
|
13
12
|
|
|
14
|
-
Aliases: `
|
|
13
|
+
Aliases: `heading-increment`
|
|
15
14
|
|
|
16
15
|
This rule is triggered when you skip heading levels in a Markdown document, for
|
|
17
16
|
example:
|
|
@@ -45,53 +44,13 @@ Rationale: Headings represent the structure of a document and can be confusing
|
|
|
45
44
|
when skipped - especially for accessibility scenarios. More information:
|
|
46
45
|
<https://www.w3.org/WAI/tutorials/page-structure/headings/>.
|
|
47
46
|
|
|
48
|
-
<a name="md002"></a>
|
|
49
|
-
|
|
50
|
-
## ~~`MD002` - First heading should be a top-level heading~~
|
|
51
|
-
|
|
52
|
-
> This rule is deprecated and provided for backward-compatibility
|
|
53
|
-
|
|
54
|
-
Tags: `headers`, `headings`
|
|
55
|
-
|
|
56
|
-
Aliases: `first-header-h1`, `first-heading-h1`
|
|
57
|
-
|
|
58
|
-
Parameters:
|
|
59
|
-
|
|
60
|
-
- `level`: Heading level (`integer`, default `1`)
|
|
61
|
-
|
|
62
|
-
> Note: *MD002 has been deprecated and is disabled by default.*
|
|
63
|
-
> [MD041/first-line-heading](md041.md) offers an improved implementation.
|
|
64
|
-
|
|
65
|
-
This rule is intended to ensure document headings start at the top level and
|
|
66
|
-
is triggered when the first heading in the document isn't an h1 heading:
|
|
67
|
-
|
|
68
|
-
```markdown
|
|
69
|
-
## This isn't an H1 heading
|
|
70
|
-
|
|
71
|
-
### Another heading
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
The first heading in the document should be an h1 heading:
|
|
75
|
-
|
|
76
|
-
```markdown
|
|
77
|
-
# Start with an H1 heading
|
|
78
|
-
|
|
79
|
-
## Then use an H2 for subsections
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
|
|
83
|
-
cases where an h1 is added externally.
|
|
84
|
-
|
|
85
|
-
Rationale: The top-level heading often acts as the title of a document. More
|
|
86
|
-
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
|
|
87
|
-
|
|
88
47
|
<a name="md003"></a>
|
|
89
48
|
|
|
90
49
|
## `MD003` - Heading style
|
|
91
50
|
|
|
92
|
-
Tags: `
|
|
51
|
+
Tags: `headings`
|
|
93
52
|
|
|
94
|
-
Aliases: `
|
|
53
|
+
Aliases: `heading-style`
|
|
95
54
|
|
|
96
55
|
Parameters:
|
|
97
56
|
|
|
@@ -255,55 +214,6 @@ the same ending column:
|
|
|
255
214
|
|
|
256
215
|
Rationale: Violations of this rule can lead to improperly rendered content.
|
|
257
216
|
|
|
258
|
-
<a name="md006"></a>
|
|
259
|
-
|
|
260
|
-
## ~~`MD006` - Consider starting bulleted lists at the beginning of the line~~
|
|
261
|
-
|
|
262
|
-
> This rule is deprecated and provided for backward-compatibility
|
|
263
|
-
|
|
264
|
-
Tags: `bullet`, `indentation`, `ul`
|
|
265
|
-
|
|
266
|
-
Aliases: `ul-start-left`
|
|
267
|
-
|
|
268
|
-
Fixable: Some violations can be fixed by tooling
|
|
269
|
-
|
|
270
|
-
This rule is triggered when top-level lists don't start at the beginning of a
|
|
271
|
-
line:
|
|
272
|
-
|
|
273
|
-
```markdown
|
|
274
|
-
Some text
|
|
275
|
-
|
|
276
|
-
* List item
|
|
277
|
-
* List item
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
To fix, ensure that top-level list items are not indented:
|
|
281
|
-
|
|
282
|
-
```markdown
|
|
283
|
-
Some test
|
|
284
|
-
|
|
285
|
-
* List item
|
|
286
|
-
* List item
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
Note: This rule is triggered for the following scenario because the unordered
|
|
290
|
-
sublist is not recognized as such by the parser. Not being nested 3 characters
|
|
291
|
-
as required by the outer ordered list, it creates a top-level unordered list
|
|
292
|
-
instead.
|
|
293
|
-
|
|
294
|
-
```markdown
|
|
295
|
-
1. List item
|
|
296
|
-
- List item
|
|
297
|
-
- List item
|
|
298
|
-
1. List item
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
Rationale: Starting lists at the beginning of the line means that nested list
|
|
302
|
-
items can all be indented by the same amount when an editor's indent function
|
|
303
|
-
or the tab key is used to indent. Starting a list 1 space in means that the
|
|
304
|
-
indent of the first nested list is less than the indent of the second level (3
|
|
305
|
-
characters if you use 4 space tabs, or 1 character if you use 2 space tabs).
|
|
306
|
-
|
|
307
217
|
<a name="md007"></a>
|
|
308
218
|
|
|
309
219
|
## `MD007` - Unordered list indentation
|
|
@@ -344,23 +254,20 @@ unordered (otherwise, extra indentation of ordered lists interferes with the
|
|
|
344
254
|
rule).
|
|
345
255
|
|
|
346
256
|
The `start_indented` parameter allows the first level of lists to be indented by
|
|
347
|
-
the configured number of spaces rather than starting at zero
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
`start_indented` is not set).
|
|
257
|
+
the configured number of spaces rather than starting at zero. The `start_indent`
|
|
258
|
+
parameter allows the first level of lists to be indented by a different number
|
|
259
|
+
of spaces than the rest (ignored when `start_indented` is not set).
|
|
351
260
|
|
|
352
261
|
Rationale: Indenting by 2 spaces allows the content of a nested list to be in
|
|
353
262
|
line with the start of the content of the parent list when a single space is
|
|
354
263
|
used after the list marker. Indenting by 4 spaces is consistent with code blocks
|
|
355
264
|
and simpler for editors to implement. Additionally, this can be a compatibility
|
|
356
265
|
issue for other Markdown parsers, which require 4-space indents. More
|
|
357
|
-
information: [Markdown Style Guide][markdown-style-guide]
|
|
358
|
-
support][marked-app-support].
|
|
266
|
+
information: [Markdown Style Guide][markdown-style-guide].
|
|
359
267
|
|
|
360
268
|
Note: See [Prettier.md](Prettier.md) for compatibility information.
|
|
361
269
|
|
|
362
270
|
[markdown-style-guide]: https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists
|
|
363
|
-
[marked-app-support]: http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting
|
|
364
271
|
|
|
365
272
|
<a name="md009"></a>
|
|
366
273
|
|
|
@@ -562,7 +469,6 @@ Parameters:
|
|
|
562
469
|
- `code_block_line_length`: Number of characters for code blocks (`integer`,
|
|
563
470
|
default `80`)
|
|
564
471
|
- `code_blocks`: Include code blocks (`boolean`, default `true`)
|
|
565
|
-
- `headers`: Include headings (`boolean`, default `true`)
|
|
566
472
|
- `heading_line_length`: Number of characters for headings (`integer`, default
|
|
567
473
|
`80`)
|
|
568
474
|
- `headings`: Include headings (`boolean`, default `true`)
|
|
@@ -571,8 +477,6 @@ Parameters:
|
|
|
571
477
|
- `strict`: Strict length checking (`boolean`, default `false`)
|
|
572
478
|
- `tables`: Include tables (`boolean`, default `true`)
|
|
573
479
|
|
|
574
|
-
> If `headings` is not provided, `headers` (deprecated) will be used.
|
|
575
|
-
|
|
576
480
|
This rule is triggered when there are lines that are longer than the
|
|
577
481
|
configured `line_length` (default: 80 characters). To fix this, split the line
|
|
578
482
|
up into multiple lines. To set a different maximum length for headings, use
|
|
@@ -673,7 +577,7 @@ for more information.
|
|
|
673
577
|
|
|
674
578
|
## `MD018` - No space after hash on atx style heading
|
|
675
579
|
|
|
676
|
-
Tags: `atx`, `
|
|
580
|
+
Tags: `atx`, `headings`, `spaces`
|
|
677
581
|
|
|
678
582
|
Aliases: `no-missing-space-atx`
|
|
679
583
|
|
|
@@ -703,7 +607,7 @@ Rationale: Violations of this rule can lead to improperly rendered content.
|
|
|
703
607
|
|
|
704
608
|
## `MD019` - Multiple spaces after hash on atx style heading
|
|
705
609
|
|
|
706
|
-
Tags: `atx`, `
|
|
610
|
+
Tags: `atx`, `headings`, `spaces`
|
|
707
611
|
|
|
708
612
|
Aliases: `no-multiple-space-atx`
|
|
709
613
|
|
|
@@ -734,7 +638,7 @@ content.
|
|
|
734
638
|
|
|
735
639
|
## `MD020` - No space inside hashes on closed atx style heading
|
|
736
640
|
|
|
737
|
-
Tags: `atx_closed`, `
|
|
641
|
+
Tags: `atx_closed`, `headings`, `spaces`
|
|
738
642
|
|
|
739
643
|
Aliases: `no-missing-space-closed-atx`
|
|
740
644
|
|
|
@@ -766,7 +670,7 @@ Rationale: Violations of this rule can lead to improperly rendered content.
|
|
|
766
670
|
|
|
767
671
|
## `MD021` - Multiple spaces inside hashes on closed atx style heading
|
|
768
672
|
|
|
769
|
-
Tags: `atx_closed`, `
|
|
673
|
+
Tags: `atx_closed`, `headings`, `spaces`
|
|
770
674
|
|
|
771
675
|
Aliases: `no-multiple-space-closed-atx`
|
|
772
676
|
|
|
@@ -800,9 +704,9 @@ content.
|
|
|
800
704
|
|
|
801
705
|
## `MD022` - Headings should be surrounded by blank lines
|
|
802
706
|
|
|
803
|
-
Tags: `blank_lines`, `
|
|
707
|
+
Tags: `blank_lines`, `headings`
|
|
804
708
|
|
|
805
|
-
Aliases: `blanks-around-
|
|
709
|
+
Aliases: `blanks-around-headings`
|
|
806
710
|
|
|
807
711
|
Parameters:
|
|
808
712
|
|
|
@@ -855,9 +759,9 @@ as regular text.
|
|
|
855
759
|
|
|
856
760
|
## `MD023` - Headings must start at the beginning of the line
|
|
857
761
|
|
|
858
|
-
Tags: `
|
|
762
|
+
Tags: `headings`, `spaces`
|
|
859
763
|
|
|
860
|
-
Aliases: `
|
|
764
|
+
Aliases: `heading-start-left`
|
|
861
765
|
|
|
862
766
|
Fixable: Some violations can be fixed by tooling
|
|
863
767
|
|
|
@@ -877,6 +781,13 @@ Some text
|
|
|
877
781
|
# Heading
|
|
878
782
|
```
|
|
879
783
|
|
|
784
|
+
Note that scenarios like block quotes "indent" the start of the line, so the
|
|
785
|
+
following is also correct:
|
|
786
|
+
|
|
787
|
+
```markdown
|
|
788
|
+
> # Heading in Block Quote
|
|
789
|
+
```
|
|
790
|
+
|
|
880
791
|
Rationale: Headings that don't start at the beginning of the line will not be
|
|
881
792
|
parsed as headings, and will instead appear as regular text.
|
|
882
793
|
|
|
@@ -884,9 +795,9 @@ parsed as headings, and will instead appear as regular text.
|
|
|
884
795
|
|
|
885
796
|
## `MD024` - Multiple headings with the same content
|
|
886
797
|
|
|
887
|
-
Tags: `
|
|
798
|
+
Tags: `headings`
|
|
888
799
|
|
|
889
|
-
Aliases: `no-duplicate-
|
|
800
|
+
Aliases: `no-duplicate-heading`
|
|
890
801
|
|
|
891
802
|
Parameters:
|
|
892
803
|
|
|
@@ -934,7 +845,7 @@ heading name; headings with the same content can cause problems with that.
|
|
|
934
845
|
|
|
935
846
|
## `MD025` - Multiple top-level headings in the same document
|
|
936
847
|
|
|
937
|
-
Tags: `
|
|
848
|
+
Tags: `headings`
|
|
938
849
|
|
|
939
850
|
Aliases: `single-h1`, `single-title`
|
|
940
851
|
|
|
@@ -986,7 +897,7 @@ be contained within this heading.
|
|
|
986
897
|
|
|
987
898
|
## `MD026` - Trailing punctuation in heading
|
|
988
899
|
|
|
989
|
-
Tags: `
|
|
900
|
+
Tags: `headings`
|
|
990
901
|
|
|
991
902
|
Aliases: `no-trailing-punctuation`
|
|
992
903
|
|
|
@@ -1349,31 +1260,48 @@ followed by a blank line:
|
|
|
1349
1260
|
|
|
1350
1261
|
```markdown
|
|
1351
1262
|
Some text
|
|
1352
|
-
*
|
|
1353
|
-
* List
|
|
1263
|
+
* List item
|
|
1264
|
+
* List item
|
|
1354
1265
|
|
|
1355
|
-
1.
|
|
1356
|
-
2. List
|
|
1357
|
-
|
|
1266
|
+
1. List item
|
|
1267
|
+
2. List item
|
|
1268
|
+
***
|
|
1358
1269
|
```
|
|
1359
1270
|
|
|
1360
|
-
|
|
1361
|
-
|
|
1271
|
+
In the first case above, text immediately precedes the unordered list. In the
|
|
1272
|
+
second case above, a thematic break immediately follows the ordered list. To fix
|
|
1273
|
+
violations of this rule, ensure that all lists have a blank line both before and
|
|
1274
|
+
after (except when the list is at the very beginning or end of the document):
|
|
1362
1275
|
|
|
1363
1276
|
```markdown
|
|
1364
1277
|
Some text
|
|
1365
1278
|
|
|
1366
|
-
*
|
|
1367
|
-
* List
|
|
1279
|
+
* List item
|
|
1280
|
+
* List item
|
|
1281
|
+
|
|
1282
|
+
1. List item
|
|
1283
|
+
2. List item
|
|
1368
1284
|
|
|
1369
|
-
|
|
1370
|
-
|
|
1285
|
+
***
|
|
1286
|
+
```
|
|
1371
1287
|
|
|
1372
|
-
|
|
1288
|
+
Note that the following case is **not** a violation of this rule:
|
|
1289
|
+
|
|
1290
|
+
```markdown
|
|
1291
|
+
1. List item
|
|
1292
|
+
More item 1
|
|
1293
|
+
2. List item
|
|
1294
|
+
More item 2
|
|
1373
1295
|
```
|
|
1374
1296
|
|
|
1375
|
-
|
|
1376
|
-
|
|
1297
|
+
Although it is not indented, the text "More item 2" is referred to as a
|
|
1298
|
+
[lazy continuation line][lazy-continuation] and considered part of the second
|
|
1299
|
+
list item.
|
|
1300
|
+
|
|
1301
|
+
Rationale: In addition to aesthetic reasons, some parsers, including kramdown,
|
|
1302
|
+
will not parse lists that don't have blank lines before and after them.
|
|
1303
|
+
|
|
1304
|
+
[lazy-continuation]: https://spec.commonmark.org/0.30/#lazy-continuation-line
|
|
1377
1305
|
|
|
1378
1306
|
<a name="md033"></a>
|
|
1379
1307
|
|
|
@@ -1507,9 +1435,9 @@ Rationale: Consistent formatting makes it easier to understand a document.
|
|
|
1507
1435
|
|
|
1508
1436
|
## `MD036` - Emphasis used instead of a heading
|
|
1509
1437
|
|
|
1510
|
-
Tags: `emphasis`, `
|
|
1438
|
+
Tags: `emphasis`, `headings`
|
|
1511
1439
|
|
|
1512
|
-
Aliases: `no-emphasis-as-
|
|
1440
|
+
Aliases: `no-emphasis-as-heading`
|
|
1513
1441
|
|
|
1514
1442
|
Parameters:
|
|
1515
1443
|
|
|
@@ -1717,7 +1645,7 @@ correct syntax highlighting for code. More information:
|
|
|
1717
1645
|
|
|
1718
1646
|
## `MD041` - First line in a file should be a top-level heading
|
|
1719
1647
|
|
|
1720
|
-
Tags: `
|
|
1648
|
+
Tags: `headings`
|
|
1721
1649
|
|
|
1722
1650
|
Aliases: `first-line-h1`, `first-line-heading`
|
|
1723
1651
|
|
|
@@ -1804,18 +1732,15 @@ links.
|
|
|
1804
1732
|
|
|
1805
1733
|
## `MD043` - Required heading structure
|
|
1806
1734
|
|
|
1807
|
-
Tags: `
|
|
1735
|
+
Tags: `headings`
|
|
1808
1736
|
|
|
1809
|
-
Aliases: `required-
|
|
1737
|
+
Aliases: `required-headings`
|
|
1810
1738
|
|
|
1811
1739
|
Parameters:
|
|
1812
1740
|
|
|
1813
|
-
- `headers`: List of headings (`string[]`, default `[]`)
|
|
1814
1741
|
- `headings`: List of headings (`string[]`, default `[]`)
|
|
1815
1742
|
- `match_case`: Match case of headings (`boolean`, default `false`)
|
|
1816
1743
|
|
|
1817
|
-
> If `headings` is not provided, `headers` (deprecated) will be used.
|
|
1818
|
-
|
|
1819
1744
|
This rule is triggered when the headings in a file do not match the array of
|
|
1820
1745
|
headings passed to the rule. It can be used to enforce a standard heading
|
|
1821
1746
|
structure for a set of files.
|
|
@@ -1940,6 +1865,12 @@ Or with reference syntax as:
|
|
|
1940
1865
|
[ref]: image.jpg "Optional title"
|
|
1941
1866
|
```
|
|
1942
1867
|
|
|
1868
|
+
Or with HTML as:
|
|
1869
|
+
|
|
1870
|
+
```html
|
|
1871
|
+
<img src="image.jpg" alt="Alternate text" />
|
|
1872
|
+
```
|
|
1873
|
+
|
|
1943
1874
|
Guidance for writing alternate text is available from the [W3C][w3c],
|
|
1944
1875
|
[Wikipedia][wikipedia], and [other locations][phase2technology].
|
|
1945
1876
|
|
|
@@ -2076,7 +2007,7 @@ Rationale: Consistent formatting makes it easier to understand a document.
|
|
|
2076
2007
|
|
|
2077
2008
|
<a name="md049"></a>
|
|
2078
2009
|
|
|
2079
|
-
## `MD049` - Emphasis style
|
|
2010
|
+
## `MD049` - Emphasis style
|
|
2080
2011
|
|
|
2081
2012
|
Tags: `emphasis`
|
|
2082
2013
|
|
|
@@ -2111,7 +2042,7 @@ Rationale: Consistent formatting makes it easier to understand a document.
|
|
|
2111
2042
|
|
|
2112
2043
|
<a name="md050"></a>
|
|
2113
2044
|
|
|
2114
|
-
## `MD050` - Strong style
|
|
2045
|
+
## `MD050` - Strong style
|
|
2115
2046
|
|
|
2116
2047
|
Tags: `emphasis`
|
|
2117
2048
|
|
|
@@ -2266,9 +2197,9 @@ Parameters:
|
|
|
2266
2197
|
Fixable: Some violations can be fixed by tooling
|
|
2267
2198
|
|
|
2268
2199
|
Links and images in Markdown can provide the link destination or image source
|
|
2269
|
-
at the time of use or can
|
|
2270
|
-
The reference format is convenient for keeping paragraph
|
|
2271
|
-
and makes it easy to reuse the same URL in multiple places.
|
|
2200
|
+
at the time of use or can use a label to reference a definition elsewhere in
|
|
2201
|
+
the document. The latter reference format is convenient for keeping paragraph
|
|
2202
|
+
text clutter-free and makes it easy to reuse the same URL in multiple places.
|
|
2272
2203
|
|
|
2273
2204
|
Because link and image reference definitions are located separately from
|
|
2274
2205
|
where they are used, there are two scenarios where a definition can be
|
|
@@ -2292,6 +2223,109 @@ Markdown:
|
|
|
2292
2223
|
[//]: # (This behaves like a comment)
|
|
2293
2224
|
```
|
|
2294
2225
|
|
|
2226
|
+
<a name="md054"></a>
|
|
2227
|
+
|
|
2228
|
+
## `MD054` - Link and image style
|
|
2229
|
+
|
|
2230
|
+
Tags: `images`, `links`
|
|
2231
|
+
|
|
2232
|
+
Aliases: `link-image-style`
|
|
2233
|
+
|
|
2234
|
+
Parameters:
|
|
2235
|
+
|
|
2236
|
+
- `autolink`: Allow autolinks (`boolean`, default `true`)
|
|
2237
|
+
- `collapsed`: Allow collapsed reference links and images (`boolean`, default
|
|
2238
|
+
`true`)
|
|
2239
|
+
- `full`: Allow full reference links and images (`boolean`, default `true`)
|
|
2240
|
+
- `inline`: Allow inline links and images (`boolean`, default `true`)
|
|
2241
|
+
- `shortcut`: Allow shortcut reference links and images (`boolean`, default
|
|
2242
|
+
`true`)
|
|
2243
|
+
- `url_inline`: Allow URLs as inline links (`boolean`, default `true`)
|
|
2244
|
+
|
|
2245
|
+
Fixable: Some violations can be fixed by tooling
|
|
2246
|
+
|
|
2247
|
+
Links and images in Markdown can provide the link destination or image source at
|
|
2248
|
+
the time of use or can use a label to reference a definition elsewhere in the
|
|
2249
|
+
document. The three reference formats are convenient for keeping paragraph text
|
|
2250
|
+
clutter-free and make it easy to reuse the same URL in multiple places.
|
|
2251
|
+
|
|
2252
|
+
By default, this rule allows all link/image styles.
|
|
2253
|
+
|
|
2254
|
+
Setting the `autolink` parameter to `false` disables autolinks:
|
|
2255
|
+
|
|
2256
|
+
```markdown
|
|
2257
|
+
<https://example.com>
|
|
2258
|
+
```
|
|
2259
|
+
|
|
2260
|
+
Setting the `inline` parameter to `false` disables inline links and images:
|
|
2261
|
+
|
|
2262
|
+
```markdown
|
|
2263
|
+
[link](https://example.com)
|
|
2264
|
+
|
|
2265
|
+

|
|
2266
|
+
```
|
|
2267
|
+
|
|
2268
|
+
Setting the `full` parameter to `false` disables full reference links and
|
|
2269
|
+
images:
|
|
2270
|
+
|
|
2271
|
+
```markdown
|
|
2272
|
+
[link][url]
|
|
2273
|
+
|
|
2274
|
+
![image][url]
|
|
2275
|
+
|
|
2276
|
+
[url]: https://example.com
|
|
2277
|
+
```
|
|
2278
|
+
|
|
2279
|
+
Setting the `collapsed` parameter to `false` disables collapsed reference links
|
|
2280
|
+
and images:
|
|
2281
|
+
|
|
2282
|
+
```markdown
|
|
2283
|
+
[url][]
|
|
2284
|
+
|
|
2285
|
+
![url][]
|
|
2286
|
+
|
|
2287
|
+
[url]: https://example.com
|
|
2288
|
+
```
|
|
2289
|
+
|
|
2290
|
+
Setting the `shortcut` parameter to `false` disables shortcut reference links
|
|
2291
|
+
and images:
|
|
2292
|
+
|
|
2293
|
+
```markdown
|
|
2294
|
+
[url]
|
|
2295
|
+
|
|
2296
|
+
![url]
|
|
2297
|
+
|
|
2298
|
+
[url]: https://example.com
|
|
2299
|
+
```
|
|
2300
|
+
|
|
2301
|
+
To fix violations of this rule, change the link or image to use an allowed
|
|
2302
|
+
style. This rule can automatically fix violations when a link or image can be
|
|
2303
|
+
converted to the `inline` style (preferred) or a link can be converted to the
|
|
2304
|
+
`autolink` style (which does not support images and must be an absolute URL).
|
|
2305
|
+
This rule does *not* fix scenarios that require converting a link or image to
|
|
2306
|
+
the `full`, `collapsed`, or `shortcut` reference styles because that involves
|
|
2307
|
+
naming the reference and determining where to insert it in the document.
|
|
2308
|
+
|
|
2309
|
+
Setting the `url_inline` parameter to `false` prevents the use of inline links
|
|
2310
|
+
with the same absolute URL text/destination and no title because such links can
|
|
2311
|
+
be converted to autolinks:
|
|
2312
|
+
|
|
2313
|
+
```markdown
|
|
2314
|
+
[https://example.com](https://example.com)
|
|
2315
|
+
```
|
|
2316
|
+
|
|
2317
|
+
To fix `url_inline` violations, use the simpler autolink syntax instead:
|
|
2318
|
+
|
|
2319
|
+
```markdown
|
|
2320
|
+
<https://example.com>
|
|
2321
|
+
```
|
|
2322
|
+
|
|
2323
|
+
Rationale: Consistent formatting makes it easier to understand a document.
|
|
2324
|
+
Autolinks are concise, but appear as URLs which can be long and confusing.
|
|
2325
|
+
Inline links and images can include descriptive text, but take up more space in
|
|
2326
|
+
Markdown form. Reference links and images can be easier to read and manipulate
|
|
2327
|
+
in Markdown form, but require a separate link reference definition.
|
|
2328
|
+
|
|
2295
2329
|
<!-- markdownlint-configure-file {
|
|
2296
2330
|
"no-inline-html": {
|
|
2297
2331
|
"allowed_elements": [
|
package/doc/md001.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# `MD001` - Heading levels should only increment by one level at a time
|
|
2
2
|
|
|
3
|
-
Tags: `
|
|
3
|
+
Tags: `headings`
|
|
4
4
|
|
|
5
|
-
Aliases: `
|
|
5
|
+
Aliases: `heading-increment`
|
|
6
6
|
|
|
7
7
|
This rule is triggered when you skip heading levels in a Markdown document, for
|
|
8
8
|
example:
|
package/doc/md003.md
CHANGED
package/doc/md007.md
CHANGED
|
@@ -36,20 +36,17 @@ unordered (otherwise, extra indentation of ordered lists interferes with the
|
|
|
36
36
|
rule).
|
|
37
37
|
|
|
38
38
|
The `start_indented` parameter allows the first level of lists to be indented by
|
|
39
|
-
the configured number of spaces rather than starting at zero
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
`start_indented` is not set).
|
|
39
|
+
the configured number of spaces rather than starting at zero. The `start_indent`
|
|
40
|
+
parameter allows the first level of lists to be indented by a different number
|
|
41
|
+
of spaces than the rest (ignored when `start_indented` is not set).
|
|
43
42
|
|
|
44
43
|
Rationale: Indenting by 2 spaces allows the content of a nested list to be in
|
|
45
44
|
line with the start of the content of the parent list when a single space is
|
|
46
45
|
used after the list marker. Indenting by 4 spaces is consistent with code blocks
|
|
47
46
|
and simpler for editors to implement. Additionally, this can be a compatibility
|
|
48
47
|
issue for other Markdown parsers, which require 4-space indents. More
|
|
49
|
-
information: [Markdown Style Guide][markdown-style-guide]
|
|
50
|
-
support][marked-app-support].
|
|
48
|
+
information: [Markdown Style Guide][markdown-style-guide].
|
|
51
49
|
|
|
52
50
|
Note: See [Prettier.md](Prettier.md) for compatibility information.
|
|
53
51
|
|
|
54
52
|
[markdown-style-guide]: https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists
|
|
55
|
-
[marked-app-support]: http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting
|
package/doc/md013.md
CHANGED
|
@@ -9,7 +9,6 @@ Parameters:
|
|
|
9
9
|
- `code_block_line_length`: Number of characters for code blocks (`integer`,
|
|
10
10
|
default `80`)
|
|
11
11
|
- `code_blocks`: Include code blocks (`boolean`, default `true`)
|
|
12
|
-
- `headers`: Include headings (`boolean`, default `true`)
|
|
13
12
|
- `heading_line_length`: Number of characters for headings (`integer`, default
|
|
14
13
|
`80`)
|
|
15
14
|
- `headings`: Include headings (`boolean`, default `true`)
|
|
@@ -18,8 +17,6 @@ Parameters:
|
|
|
18
17
|
- `strict`: Strict length checking (`boolean`, default `false`)
|
|
19
18
|
- `tables`: Include tables (`boolean`, default `true`)
|
|
20
19
|
|
|
21
|
-
> If `headings` is not provided, `headers` (deprecated) will be used.
|
|
22
|
-
|
|
23
20
|
This rule is triggered when there are lines that are longer than the
|
|
24
21
|
configured `line_length` (default: 80 characters). To fix this, split the line
|
|
25
22
|
up into multiple lines. To set a different maximum length for headings, use
|
package/doc/md018.md
CHANGED
package/doc/md019.md
CHANGED
package/doc/md020.md
CHANGED
package/doc/md021.md
CHANGED
package/doc/md022.md
CHANGED
package/doc/md023.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# `MD023` - Headings must start at the beginning of the line
|
|
2
2
|
|
|
3
|
-
Tags: `
|
|
3
|
+
Tags: `headings`, `spaces`
|
|
4
4
|
|
|
5
|
-
Aliases: `
|
|
5
|
+
Aliases: `heading-start-left`
|
|
6
6
|
|
|
7
7
|
Fixable: Some violations can be fixed by tooling
|
|
8
8
|
|
|
@@ -22,5 +22,12 @@ Some text
|
|
|
22
22
|
# Heading
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
Note that scenarios like block quotes "indent" the start of the line, so the
|
|
26
|
+
following is also correct:
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
> # Heading in Block Quote
|
|
30
|
+
```
|
|
31
|
+
|
|
25
32
|
Rationale: Headings that don't start at the beginning of the line will not be
|
|
26
33
|
parsed as headings, and will instead appear as regular text.
|
package/doc/md024.md
CHANGED