markdownlint 0.26.2 → 0.28.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +378 -0
  2. package/CONTRIBUTING.md +82 -59
  3. package/LICENSE +1 -1
  4. package/README.md +304 -305
  5. package/demo/markdownlint-browser.js +4973 -3379
  6. package/doc/CustomRules.md +99 -51
  7. package/doc/Prettier.md +14 -10
  8. package/doc/ReleaseProcess.md +20 -0
  9. package/doc/Rules.md +474 -311
  10. package/doc/md001.md +37 -0
  11. package/doc/md002.md +37 -0
  12. package/doc/md003.md +59 -0
  13. package/doc/md004.md +49 -0
  14. package/doc/md005.md +53 -0
  15. package/doc/md006.md +46 -0
  16. package/doc/md007.md +55 -0
  17. package/doc/md009.md +51 -0
  18. package/doc/md010.md +56 -0
  19. package/doc/md011.md +30 -0
  20. package/doc/md012.md +38 -0
  21. package/doc/md013.md +60 -0
  22. package/doc/md014.md +54 -0
  23. package/doc/md018.md +27 -0
  24. package/doc/md019.md +28 -0
  25. package/doc/md020.md +29 -0
  26. package/doc/md021.md +31 -0
  27. package/doc/md022.md +46 -0
  28. package/doc/md023.md +26 -0
  29. package/doc/md024.md +47 -0
  30. package/doc/md025.md +49 -0
  31. package/doc/md026.md +41 -0
  32. package/doc/md027.md +24 -0
  33. package/doc/md028.md +40 -0
  34. package/doc/md029.md +98 -0
  35. package/doc/md030.md +82 -0
  36. package/doc/md031.md +50 -0
  37. package/doc/md032.md +38 -0
  38. package/doc/md033.md +27 -0
  39. package/doc/md034.md +50 -0
  40. package/doc/md035.md +42 -0
  41. package/doc/md036.md +45 -0
  42. package/doc/md037.md +37 -0
  43. package/doc/md038.md +40 -0
  44. package/doc/md039.md +21 -0
  45. package/doc/md040.md +52 -0
  46. package/doc/md041.md +49 -0
  47. package/doc/md042.md +32 -0
  48. package/doc/md043.md +72 -0
  49. package/doc/md044.md +35 -0
  50. package/doc/md045.md +34 -0
  51. package/doc/md046.md +40 -0
  52. package/doc/md047.md +34 -0
  53. package/doc/md048.md +41 -0
  54. package/doc/md049.md +32 -0
  55. package/doc/md050.md +32 -0
  56. package/doc/md051.md +50 -0
  57. package/doc/md052.md +33 -0
  58. package/doc/md053.md +38 -0
  59. package/helpers/LICENSE +1 -1
  60. package/helpers/README.md +35 -15
  61. package/helpers/helpers.js +182 -162
  62. package/helpers/micromark.cjs +209 -0
  63. package/helpers/package.json +5 -2
  64. package/lib/constants.js +8 -1
  65. package/lib/markdownlint.d.ts +5 -5
  66. package/lib/markdownlint.js +46 -24
  67. package/lib/md002.js +1 -1
  68. package/lib/md011.js +2 -2
  69. package/lib/md013.js +7 -6
  70. package/lib/md019.js +1 -1
  71. package/lib/md022.js +15 -3
  72. package/lib/md023.js +1 -1
  73. package/lib/md026.js +1 -1
  74. package/lib/md027.js +1 -1
  75. package/lib/md028.js +1 -1
  76. package/lib/md033.js +47 -29
  77. package/lib/md034.js +54 -47
  78. package/lib/md035.js +9 -11
  79. package/lib/md036.js +1 -1
  80. package/lib/md037.js +2 -2
  81. package/lib/md038.js +81 -56
  82. package/lib/md039.js +1 -1
  83. package/lib/md040.js +21 -2
  84. package/lib/md041.js +1 -1
  85. package/lib/md043.js +4 -2
  86. package/lib/md044.js +58 -43
  87. package/lib/md046.js +1 -1
  88. package/lib/md048.js +3 -1
  89. package/lib/md051.js +37 -5
  90. package/lib/rules.js +1 -1
  91. package/package.json +43 -28
  92. package/schema/.markdownlint.jsonc +11 -4
  93. package/schema/.markdownlint.yaml +11 -6
  94. package/schema/markdownlint-config-schema.json +27 -3
  95. package/style/prettier.json +26 -0
package/doc/Rules.md CHANGED
@@ -7,11 +7,11 @@ deprecated, but still provided for backward-compatibility.
7
7
 
8
8
  <a name="md001"></a>
9
9
 
10
- ## MD001 - Heading levels should only increment by one level at a time
10
+ ## `MD001` - Heading levels should only increment by one level at a time
11
11
 
12
- Tags: headings, headers
12
+ Tags: `headers`, `headings`
13
13
 
14
- Aliases: heading-increment, header-increment
14
+ Aliases: `header-increment`, `heading-increment`
15
15
 
16
16
  This rule is triggered when you skip heading levels in a Markdown document, for
17
17
  example:
@@ -47,16 +47,20 @@ when skipped - especially for accessibility scenarios. More information:
47
47
 
48
48
  <a name="md002"></a>
49
49
 
50
- ## ~~MD002 - First heading should be a top-level heading~~
50
+ ## ~~`MD002` - First heading should be a top-level heading~~
51
51
 
52
- Tags: headings, headers
52
+ > This rule is deprecated and provided for backward-compatibility
53
53
 
54
- Aliases: first-heading-h1, first-header-h1
54
+ Tags: `headers`, `headings`
55
55
 
56
- Parameters: level (number; default 1)
56
+ Aliases: `first-header-h1`, `first-heading-h1`
57
+
58
+ Parameters:
59
+
60
+ - `level`: Heading level (`integer`, default `1`)
57
61
 
58
62
  > Note: *MD002 has been deprecated and is disabled by default.*
59
- > [MD041/first-line-heading](#md041) offers an improved implementation.
63
+ > [MD041/first-line-heading](md041.md) offers an improved implementation.
60
64
 
61
65
  This rule is intended to ensure document headings start at the top level and
62
66
  is triggered when the first heading in the document isn't an h1 heading:
@@ -83,17 +87,20 @@ information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
83
87
 
84
88
  <a name="md003"></a>
85
89
 
86
- ## MD003 - Heading style
90
+ ## `MD003` - Heading style
87
91
 
88
- Tags: headings, headers
92
+ Tags: `headers`, `headings`
89
93
 
90
- Aliases: heading-style, header-style
94
+ Aliases: `header-style`, `heading-style`
91
95
 
92
- Parameters: style ("consistent", "atx", "atx_closed", "setext",
93
- "setext_with_atx", "setext_with_atx_closed"; default "consistent")
96
+ Parameters:
94
97
 
95
- This rule is triggered when different heading styles (atx, setext, and 'closed'
96
- atx) are used in the same document:
98
+ - `style`: Heading style (`string`, default `consistent`, values `atx` /
99
+ `atx_closed` / `consistent` / `setext` / `setext_with_atx` /
100
+ `setext_with_atx_closed`)
101
+
102
+ This rule is triggered when different heading styles are used in the same
103
+ document:
97
104
 
98
105
  ```markdown
99
106
  # ATX style H1
@@ -104,7 +111,7 @@ Setext style H1
104
111
  ===============
105
112
  ```
106
113
 
107
- Be consistent with the style of heading used in a document:
114
+ To fix the issue, use consistent heading styles throughout the document:
108
115
 
109
116
  ```markdown
110
117
  # ATX style H1
@@ -112,8 +119,9 @@ Be consistent with the style of heading used in a document:
112
119
  ## ATX style H2
113
120
  ```
114
121
 
115
- The setext_with_atx and setext_with_atx_closed doc styles allow atx-style
116
- headings of level 3 or more in documents with setext style headings:
122
+ The `setext_with_atx` and `setext_with_atx_closed` settings allow ATX-style
123
+ headings of level 3 or more in documents with setext-style headings (which only
124
+ support level 1 and 2 headings):
117
125
 
118
126
  ```markdown
119
127
  Setext style H1
@@ -125,24 +133,34 @@ Setext style H2
125
133
  ### ATX style H3
126
134
  ```
127
135
 
128
- Note: the configured heading style can be a specific style to use (atx,
129
- atx_closed, setext, setext_with_atx, setext_with_atx_closed), or simply require
130
- that the usage is consistent within the document.
136
+ Note: The configured heading style can be a specific style to require (`atx`,
137
+ `atx_closed`, `setext`, `setext_with_atx`, `setext_with_atx_closed`), or may
138
+ just require that usage is consistent within the document via `consistent`.
139
+
140
+ Note: The placement of a horizontal rule directly below a line of text can
141
+ trigger this rule by turning that text into a level 2 setext-style heading:
142
+
143
+ ```markdown
144
+ A line of text followed by a horizontal rule becomes a heading
145
+ ---
146
+ ```
131
147
 
132
148
  Rationale: Consistent formatting makes it easier to understand a document.
133
149
 
134
150
  <a name="md004"></a>
135
151
 
136
- ## MD004 - Unordered list style
152
+ ## `MD004` - Unordered list style
137
153
 
138
- Tags: bullet, ul
154
+ Tags: `bullet`, `ul`
139
155
 
140
- Aliases: ul-style
156
+ Aliases: `ul-style`
141
157
 
142
- Parameters: style ("consistent", "asterisk", "plus", "dash", "sublist"; default
143
- "consistent")
158
+ Parameters:
144
159
 
145
- Fixable: Most violations can be fixed by tooling
160
+ - `style`: List style (`string`, default `consistent`, values `asterisk` /
161
+ `consistent` / `dash` / `plus` / `sublist`)
162
+
163
+ Fixable: Some violations can be fixed by tooling
146
164
 
147
165
  This rule is triggered when the symbols used in the document for unordered
148
166
  list items do not match the configured unordered list style:
@@ -162,13 +180,13 @@ document:
162
180
  * Item 3
163
181
  ```
164
182
 
165
- The configured list style can be a specific symbol to use (asterisk, plus, dash),
166
- to ensure that all list styling is consistent, or to ensure that each
183
+ The configured list style can be a specific symbol to use (asterisk, plus,
184
+ dash), to ensure that all list styling is consistent, or to ensure that each
167
185
  sublist has a consistent symbol that differs from its parent list.
168
186
 
169
- For example, the following is valid for the `sublist` style because the outer-most
170
- indent uses asterisk, the middle indent uses plus, and the inner-most indent uses
171
- dash:
187
+ For example, the following is valid for the `sublist` style because the
188
+ outer-most indent uses asterisk, the middle indent uses plus, and the inner-most
189
+ indent uses dash:
172
190
 
173
191
  ```markdown
174
192
  * Item 1
@@ -183,13 +201,13 @@ Rationale: Consistent formatting makes it easier to understand a document.
183
201
 
184
202
  <a name="md005"></a>
185
203
 
186
- ## MD005 - Inconsistent indentation for list items at the same level
204
+ ## `MD005` - Inconsistent indentation for list items at the same level
187
205
 
188
- Tags: bullet, ul, indentation
206
+ Tags: `bullet`, `indentation`, `ul`
189
207
 
190
- Aliases: list-indent
208
+ Aliases: `list-indent`
191
209
 
192
- Fixable: Most violations can be fixed by tooling
210
+ Fixable: Some violations can be fixed by tooling
193
211
 
194
212
  This rule is triggered when list items are parsed as being at the same level,
195
213
  but don't have the same indentation:
@@ -239,13 +257,15 @@ Rationale: Violations of this rule can lead to improperly rendered content.
239
257
 
240
258
  <a name="md006"></a>
241
259
 
242
- ## ~~MD006 - Consider starting bulleted lists at the beginning of the line~~
260
+ ## ~~`MD006` - Consider starting bulleted lists at the beginning of the line~~
261
+
262
+ > This rule is deprecated and provided for backward-compatibility
243
263
 
244
- Tags: bullet, ul, indentation
264
+ Tags: `bullet`, `indentation`, `ul`
245
265
 
246
- Aliases: ul-start-left
266
+ Aliases: `ul-start-left`
247
267
 
248
- Fixable: Most violations can be fixed by tooling
268
+ Fixable: Some violations can be fixed by tooling
249
269
 
250
270
  This rule is triggered when top-level lists don't start at the beginning of a
251
271
  line:
@@ -286,19 +306,21 @@ characters if you use 4 space tabs, or 1 character if you use 2 space tabs).
286
306
 
287
307
  <a name="md007"></a>
288
308
 
289
- ## MD007 - Unordered list indentation
309
+ ## `MD007` - Unordered list indentation
290
310
 
291
- Tags: bullet, ul, indentation
311
+ Tags: `bullet`, `indentation`, `ul`
292
312
 
293
- Aliases: ul-indent
313
+ Aliases: `ul-indent`
294
314
 
295
- <!-- markdownlint-disable line-length -->
315
+ Parameters:
296
316
 
297
- Parameters: indent, start_indented, start_indent (number; default 2, boolean; default false, number; defaults to indent)
298
-
299
- <!-- markdownlint-restore -->
317
+ - `indent`: Spaces for indent (`integer`, default `2`)
318
+ - `start_indent`: Spaces for first level indent (when start_indented is set)
319
+ (`integer`, default `2`)
320
+ - `start_indented`: Whether to indent the first level of the list (`boolean`,
321
+ default `false`)
300
322
 
301
- Fixable: Most violations can be fixed by tooling
323
+ Fixable: Some violations can be fixed by tooling
302
324
 
303
325
  This rule is triggered when list items are not indented by the configured
304
326
  number of spaces (default: 2).
@@ -323,38 +345,42 @@ rule).
323
345
 
324
346
  The `start_indented` parameter allows the first level of lists to be indented by
325
347
  the configured number of spaces rather than starting at zero (the inverse of
326
- MD006). The `start_indent` parameter allows the first level of lists to be indented
327
- by a different number of spaces than the rest (ignored when `start_indented` is not
328
- set).
348
+ MD006). The `start_indent` parameter allows the first level of lists to be
349
+ indented by a different number of spaces than the rest (ignored when
350
+ `start_indented` is not set).
329
351
 
330
352
  Rationale: Indenting by 2 spaces allows the content of a nested list to be in
331
353
  line with the start of the content of the parent list when a single space is
332
354
  used after the list marker. Indenting by 4 spaces is consistent with code blocks
333
355
  and simpler for editors to implement. Additionally, this can be a compatibility
334
- issue for other Markdown parsers, which require 4-space indents. More information:
335
- <https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists>
336
- and <http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting>.
356
+ issue for other Markdown parsers, which require 4-space indents. More
357
+ information: [Markdown Style Guide][markdown-style-guide] and [Marked app\
358
+ support][marked-app-support].
337
359
 
338
360
  Note: See [Prettier.md](Prettier.md) for compatibility information.
339
361
 
340
- <a name="md009"></a>
362
+ [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
341
364
 
342
- ## MD009 - Trailing spaces
365
+ <a name="md009"></a>
343
366
 
344
- Tags: whitespace
367
+ ## `MD009` - Trailing spaces
345
368
 
346
- Aliases: no-trailing-spaces
369
+ Tags: `whitespace`
347
370
 
348
- <!-- markdownlint-disable line-length -->
371
+ Aliases: `no-trailing-spaces`
349
372
 
350
- Parameters: br_spaces, list_item_empty_lines, strict (number; default 2, boolean; default false, boolean; default false)
373
+ Parameters:
351
374
 
352
- <!-- markdownlint-restore -->
375
+ - `br_spaces`: Spaces for line break (`integer`, default `2`)
376
+ - `list_item_empty_lines`: Allow spaces for empty lines in list items
377
+ (`boolean`, default `false`)
378
+ - `strict`: Include unnecessary breaks (`boolean`, default `false`)
353
379
 
354
- Fixable: Most violations can be fixed by tooling
380
+ Fixable: Some violations can be fixed by tooling
355
381
 
356
- This rule is triggered on any lines that end with unexpected whitespace. To fix this,
357
- remove the trailing space from the end of the line.
382
+ This rule is triggered on any lines that end with unexpected whitespace. To fix
383
+ this, remove the trailing space from the end of the line.
358
384
 
359
385
  Note: Trailing space is allowed in indented and fenced code blocks because some
360
386
  languages require it.
@@ -363,12 +389,14 @@ The `br_spaces` parameter allows an exception to this rule for a specific number
363
389
  of trailing spaces, typically used to insert an explicit line break. The default
364
390
  value allows 2 spaces to indicate a hard break (\<br> element).
365
391
 
366
- Note: You must set `br_spaces` to a value >= 2 for this parameter to take effect.
367
- Setting `br_spaces` to 1 behaves the same as 0, disallowing any trailing spaces.
392
+ Note: You must set `br_spaces` to a value >= 2 for this parameter to take
393
+ effect. Setting `br_spaces` to 1 behaves the same as 0, disallowing any trailing
394
+ spaces.
368
395
 
369
- By default, this rule will not trigger when the allowed number of spaces is used,
370
- even when it doesn't create a hard break (for example, at the end of a paragraph).
371
- To report such instances as well, set the `strict` parameter to `true`.
396
+ By default, this rule will not trigger when the allowed number of spaces is
397
+ used, even when it doesn't create a hard break (for example, at the end of a
398
+ paragraph). To report such instances as well, set the `strict` parameter to
399
+ `true`.
372
400
 
373
401
  ```markdown
374
402
  Text text text
@@ -390,15 +418,20 @@ has no purpose and does not affect the rendering of content.
390
418
 
391
419
  <a name="md010"></a>
392
420
 
393
- ## MD010 - Hard tabs
421
+ ## `MD010` - Hard tabs
394
422
 
395
- Tags: whitespace, hard_tab
423
+ Tags: `hard_tab`, `whitespace`
396
424
 
397
- Aliases: no-hard-tabs
425
+ Aliases: `no-hard-tabs`
398
426
 
399
- Parameters: code_blocks, ignore_code_languages, spaces_per_tab (boolean; default true, array of string; default empty, number; default 1)
427
+ Parameters:
400
428
 
401
- Fixable: Most violations can be fixed by tooling
429
+ - `code_blocks`: Include code blocks (`boolean`, default `true`)
430
+ - `ignore_code_languages`: Fenced code languages to ignore (`string[]`, default
431
+ `[]`)
432
+ - `spaces_per_tab`: Number of spaces for each hard tab (`integer`, default `1`)
433
+
434
+ Fixable: Some violations can be fixed by tooling
402
435
 
403
436
  This rule is triggered by any lines that contain hard tab characters instead
404
437
  of using spaces for indentation. To fix this, replace any hard tab characters
@@ -444,13 +477,13 @@ can be harder to work with than spaces.
444
477
 
445
478
  <a name="md011"></a>
446
479
 
447
- ## MD011 - Reversed link syntax
480
+ ## `MD011` - Reversed link syntax
448
481
 
449
- Tags: links
482
+ Tags: `links`
450
483
 
451
- Aliases: no-reversed-links
484
+ Aliases: `no-reversed-links`
452
485
 
453
- Fixable: Most violations can be fixed by tooling
486
+ Fixable: Some violations can be fixed by tooling
454
487
 
455
488
  This rule is triggered when text that appears to be a link is encountered, but
456
489
  where the syntax appears to have been reversed (the `[]` and `()` are
@@ -477,15 +510,17 @@ Rationale: Reversed links are not rendered as usable links.
477
510
 
478
511
  <a name="md012"></a>
479
512
 
480
- ## MD012 - Multiple consecutive blank lines
513
+ ## `MD012` - Multiple consecutive blank lines
514
+
515
+ Tags: `blank_lines`, `whitespace`
481
516
 
482
- Tags: whitespace, blank_lines
517
+ Aliases: `no-multiple-blanks`
483
518
 
484
- Aliases: no-multiple-blanks
519
+ Parameters:
485
520
 
486
- Parameters: maximum (number; default 1)
521
+ - `maximum`: Consecutive blank lines (`integer`, default `1`)
487
522
 
488
- Fixable: Most violations can be fixed by tooling
523
+ Fixable: Some violations can be fixed by tooling
489
524
 
490
525
  This rule is triggered when there are multiple consecutive blank lines in the
491
526
  document:
@@ -516,17 +551,25 @@ affect the rendering of content.
516
551
 
517
552
  <a name="md013"></a>
518
553
 
519
- ## MD013 - Line length
554
+ ## `MD013` - Line length
520
555
 
521
- Tags: line_length
556
+ Tags: `line_length`
522
557
 
523
- Aliases: line-length
558
+ Aliases: `line-length`
524
559
 
525
- <!-- markdownlint-disable line-length -->
560
+ Parameters:
526
561
 
527
- Parameters: line_length, heading_line_length, code_block_line_length, code_blocks, tables, headings, headers, strict, stern (number; default 80 for *_length, boolean; default true (except strict/stern which default false))
528
-
529
- <!-- markdownlint-restore -->
562
+ - `code_block_line_length`: Number of characters for code blocks (`integer`,
563
+ default `80`)
564
+ - `code_blocks`: Include code blocks (`boolean`, default `true`)
565
+ - `headers`: Include headings (`boolean`, default `true`)
566
+ - `heading_line_length`: Number of characters for headings (`integer`, default
567
+ `80`)
568
+ - `headings`: Include headings (`boolean`, default `true`)
569
+ - `line_length`: Number of characters (`integer`, default `80`)
570
+ - `stern`: Stern length checking (`boolean`, default `false`)
571
+ - `strict`: Strict length checking (`boolean`, default `false`)
572
+ - `tables`: Include tables (`boolean`, default `true`)
530
573
 
531
574
  > If `headings` is not provided, `headers` (deprecated) will be used.
532
575
 
@@ -537,11 +580,11 @@ up into multiple lines. To set a different maximum length for headings, use
537
580
  `code_block_line_length`
538
581
 
539
582
  This rule has an exception when there is no whitespace beyond the configured
540
- line length. This allows you to still include items such as long URLs without
541
- being forced to break them in the middle. To disable this exception, set the
542
- `strict` parameter to `true` to report an issue when any line is too long.
543
- To warn for lines that are too long and could be fixed but allow lines without
544
- spaces, set the `stern` parameter to `true`.
583
+ line length. This allows you to include items such as long URLs without being
584
+ forced to break them in the middle. To disable this exception, set the `strict`
585
+ parameter to `true` and an issue will be reported when any line is too long. To
586
+ warn for lines that are too long and could be fixed but allow long lines
587
+ without spaces, set the `stern` parameter to `true`.
545
588
 
546
589
  For example (assuming normal behavior):
547
590
 
@@ -562,18 +605,22 @@ Code blocks are included in this rule by default since it is often a
562
605
  requirement for document readability, and tentatively compatible with code
563
606
  rules. Still, some languages do not lend themselves to short lines.
564
607
 
608
+ Lines with link/image reference definitions are always exempted from this rule
609
+ (even in `strict` mode) because there is generally no way to split such lines
610
+ without breaking the URL.
611
+
565
612
  Rationale: Extremely long lines can be difficult to work with in some editors.
566
613
  More information: <https://cirosantilli.com/markdown-style-guide#line-wrapping>.
567
614
 
568
615
  <a name="md014"></a>
569
616
 
570
- ## MD014 - Dollar signs used before commands without showing output
617
+ ## `MD014` - Dollar signs used before commands without showing output
571
618
 
572
- Tags: code
619
+ Tags: `code`
573
620
 
574
- Aliases: commands-show-output
621
+ Aliases: `commands-show-output`
575
622
 
576
- Fixable: Most violations can be fixed by tooling
623
+ Fixable: Some violations can be fixed by tooling
577
624
 
578
625
  This rule is triggered when there are code blocks showing shell commands to be
579
626
  typed, and *all* of the shell commands are preceded by dollar signs ($):
@@ -624,13 +671,13 @@ for more information.
624
671
 
625
672
  <a name="md018"></a>
626
673
 
627
- ## MD018 - No space after hash on atx style heading
674
+ ## `MD018` - No space after hash on atx style heading
628
675
 
629
- Tags: headings, headers, atx, spaces
676
+ Tags: `atx`, `headers`, `headings`, `spaces`
630
677
 
631
- Aliases: no-missing-space-atx
678
+ Aliases: `no-missing-space-atx`
632
679
 
633
- Fixable: Most violations can be fixed by tooling
680
+ Fixable: Some violations can be fixed by tooling
634
681
 
635
682
  This rule is triggered when spaces are missing after the hash characters
636
683
  in an atx style heading:
@@ -654,13 +701,13 @@ Rationale: Violations of this rule can lead to improperly rendered content.
654
701
 
655
702
  <a name="md019"></a>
656
703
 
657
- ## MD019 - Multiple spaces after hash on atx style heading
704
+ ## `MD019` - Multiple spaces after hash on atx style heading
658
705
 
659
- Tags: headings, headers, atx, spaces
706
+ Tags: `atx`, `headers`, `headings`, `spaces`
660
707
 
661
- Aliases: no-multiple-space-atx
708
+ Aliases: `no-multiple-space-atx`
662
709
 
663
- Fixable: Most violations can be fixed by tooling
710
+ Fixable: Some violations can be fixed by tooling
664
711
 
665
712
  This rule is triggered when more than one space is used to separate the
666
713
  heading text from the hash characters in an atx style heading:
@@ -685,13 +732,13 @@ content.
685
732
 
686
733
  <a name="md020"></a>
687
734
 
688
- ## MD020 - No space inside hashes on closed atx style heading
735
+ ## `MD020` - No space inside hashes on closed atx style heading
689
736
 
690
- Tags: headings, headers, atx_closed, spaces
737
+ Tags: `atx_closed`, `headers`, `headings`, `spaces`
691
738
 
692
- Aliases: no-missing-space-closed-atx
739
+ Aliases: `no-missing-space-closed-atx`
693
740
 
694
- Fixable: Most violations can be fixed by tooling
741
+ Fixable: Some violations can be fixed by tooling
695
742
 
696
743
  This rule is triggered when spaces are missing inside the hash characters
697
744
  in a closed atx style heading:
@@ -717,13 +764,13 @@ Rationale: Violations of this rule can lead to improperly rendered content.
717
764
 
718
765
  <a name="md021"></a>
719
766
 
720
- ## MD021 - Multiple spaces inside hashes on closed atx style heading
767
+ ## `MD021` - Multiple spaces inside hashes on closed atx style heading
721
768
 
722
- Tags: headings, headers, atx_closed, spaces
769
+ Tags: `atx_closed`, `headers`, `headings`, `spaces`
723
770
 
724
- Aliases: no-multiple-space-closed-atx
771
+ Aliases: `no-multiple-space-closed-atx`
725
772
 
726
- Fixable: Most violations can be fixed by tooling
773
+ Fixable: Some violations can be fixed by tooling
727
774
 
728
775
  This rule is triggered when more than one space is used to separate the
729
776
  heading text from the hash characters in a closed atx style heading:
@@ -751,15 +798,18 @@ content.
751
798
 
752
799
  <a name="md022"></a>
753
800
 
754
- ## MD022 - Headings should be surrounded by blank lines
801
+ ## `MD022` - Headings should be surrounded by blank lines
755
802
 
756
- Tags: headings, headers, blank_lines
803
+ Tags: `blank_lines`, `headers`, `headings`
757
804
 
758
- Aliases: blanks-around-headings, blanks-around-headers
805
+ Aliases: `blanks-around-headers`, `blanks-around-headings`
759
806
 
760
- Parameters: lines_above, lines_below (number; default 1)
807
+ Parameters:
761
808
 
762
- Fixable: Most violations can be fixed by tooling
809
+ - `lines_above`: Blank lines above heading (`integer`, default `1`)
810
+ - `lines_below`: Blank lines below heading (`integer`, default `1`)
811
+
812
+ Fixable: Some violations can be fixed by tooling
763
813
 
764
814
  This rule is triggered when headings (any style) are either not preceded or not
765
815
  followed by at least one blank line:
@@ -785,25 +835,25 @@ Some more text
785
835
  ## Heading 2
786
836
  ```
787
837
 
788
- The `lines_above` and `lines_below` parameters can be used to specify a different
789
- number of blank lines (including 0) above or below each heading.
838
+ The `lines_above` and `lines_below` parameters can be used to specify a
839
+ different number of blank lines (including 0) above or below each heading.
790
840
 
791
841
  Note: If `lines_above` or `lines_below` are configured to require more than one
792
- blank line, [MD012/no-multiple-blanks](#md012) should also be customized.
842
+ blank line, [MD012/no-multiple-blanks](md012.md) should also be customized.
793
843
 
794
- Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`, will
795
- not parse headings that don't have a blank line before, and will parse them as
796
- regular text.
844
+ Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`,
845
+ will not parse headings that don't have a blank line before, and will parse them
846
+ as regular text.
797
847
 
798
848
  <a name="md023"></a>
799
849
 
800
- ## MD023 - Headings must start at the beginning of the line
850
+ ## `MD023` - Headings must start at the beginning of the line
801
851
 
802
- Tags: headings, headers, spaces
852
+ Tags: `headers`, `headings`, `spaces`
803
853
 
804
- Aliases: heading-start-left, header-start-left
854
+ Aliases: `header-start-left`, `heading-start-left`
805
855
 
806
- Fixable: Most violations can be fixed by tooling
856
+ Fixable: Some violations can be fixed by tooling
807
857
 
808
858
  This rule is triggered when a heading is indented by one or more spaces:
809
859
 
@@ -826,13 +876,17 @@ parsed as headings, and will instead appear as regular text.
826
876
 
827
877
  <a name="md024"></a>
828
878
 
829
- ## MD024 - Multiple headings with the same content
879
+ ## `MD024` - Multiple headings with the same content
880
+
881
+ Tags: `headers`, `headings`
830
882
 
831
- Tags: headings, headers
883
+ Aliases: `no-duplicate-header`, `no-duplicate-heading`
832
884
 
833
- Aliases: no-duplicate-heading, no-duplicate-header
885
+ Parameters:
834
886
 
835
- Parameters: siblings_only, allow_different_nesting (boolean; default `false`)
887
+ - `allow_different_nesting`: Only check sibling headings (`boolean`, default
888
+ `false`)
889
+ - `siblings_only`: Only check sibling headings (`boolean`, default `false`)
836
890
 
837
891
  This rule is triggered if there are multiple headings in the document that have
838
892
  the same text:
@@ -872,13 +926,17 @@ heading name; headings with the same content can cause problems with that.
872
926
 
873
927
  <a name="md025"></a>
874
928
 
875
- ## MD025 - Multiple top-level headings in the same document
929
+ ## `MD025` - Multiple top-level headings in the same document
876
930
 
877
- Tags: headings, headers
931
+ Tags: `headers`, `headings`
878
932
 
879
- Aliases: single-title, single-h1
933
+ Aliases: `single-h1`, `single-title`
880
934
 
881
- Parameters: level, front_matter_title (number; default 1, string; default "^\s*"?title"?\s*[:=]")
935
+ Parameters:
936
+
937
+ - `front_matter_title`: RegExp for matching title in front matter (`string`,
938
+ default `^\s*title\s*[:=]`)
939
+ - `level`: Heading level (`integer`, default `1`)
882
940
 
883
941
  This rule is triggered when a top-level heading is in use (the first line of
884
942
  the file is an h1 heading), and more than one h1 heading is in use in the
@@ -905,29 +963,33 @@ lower-level headings (h2, h3, etc.):
905
963
  Note: The `level` parameter can be used to change the top-level (ex: to h2) in
906
964
  cases where an h1 is added externally.
907
965
 
908
- If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and contains
909
- a `title` property (commonly used with blog posts), this rule treats that as a top
910
- level heading and will report a violation for any subsequent top-level headings.
911
- To use a different property name in the front matter, specify the text of a regular
912
- expression via the `front_matter_title` parameter. To disable the use of front
913
- matter by this rule, specify `""` for `front_matter_title`.
966
+ If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
967
+ contains a `title` property (commonly used with blog posts), this rule treats
968
+ that as a top level heading and will report a violation for any subsequent
969
+ top-level headings. To use a different property name in the front matter,
970
+ specify the text of a regular expression via the `front_matter_title` parameter.
971
+ To disable the use of front matter by this rule, specify `""` for
972
+ `front_matter_title`.
914
973
 
915
974
  Rationale: A top-level heading is an h1 on the first line of the file, and
916
975
  serves as the title for the document. If this convention is in use, then there
917
- can not be more than one title for the document, and the entire document
918
- should be contained within this heading.
976
+ can not be more than one title for the document, and the entire document should
977
+ be contained within this heading.
919
978
 
920
979
  <a name="md026"></a>
921
980
 
922
- ## MD026 - Trailing punctuation in heading
981
+ ## `MD026` - Trailing punctuation in heading
982
+
983
+ Tags: `headers`, `headings`
923
984
 
924
- Tags: headings, headers
985
+ Aliases: `no-trailing-punctuation`
925
986
 
926
- Aliases: no-trailing-punctuation
987
+ Parameters:
927
988
 
928
- Parameters: punctuation (string; default ".,;:!。,;:!")
989
+ - `punctuation`: Punctuation characters not allowed at end of headings
990
+ (`string`, default `.,;:!。,;:!`)
929
991
 
930
- Fixable: Most violations can be fixed by tooling
992
+ Fixable: Some violations can be fixed by tooling
931
993
 
932
994
  This rule is triggered on any heading that has one of the specified normal or
933
995
  full-width punctuation characters as the last character in the line:
@@ -945,26 +1007,28 @@ To fix this, remove the trailing punctuation:
945
1007
  Note: The `punctuation` parameter can be used to specify what characters count
946
1008
  as punctuation at the end of a heading. For example, you can change it to
947
1009
  `".,;:"` to allow headings that end with an exclamation point. `?` is
948
- allowed by default because of how common it is in headings of FAQ-style documents.
949
- Setting the `punctuation` parameter to `""` allows all characters - and is
950
- equivalent to disabling the rule.
1010
+ allowed by default because of how common it is in headings of FAQ-style
1011
+ documents. Setting the `punctuation` parameter to `""` allows all characters -
1012
+ and is equivalent to disabling the rule.
951
1013
 
952
- Note: The trailing semicolon of
953
- [HTML entity references](https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references)
1014
+ Note: The trailing semicolon of [HTML entity references][html-entity-references]
954
1015
  like `&copy;`, `&#169;`, and `&#x000A9;` is ignored by this rule.
955
1016
 
956
1017
  Rationale: Headings are not meant to be full sentences. More information:
957
- <https://cirosantilli.com/markdown-style-guide#punctuation-at-the-end-of-headers>
1018
+ [Punctuation at the end of headers][end-punctuation].
1019
+
1020
+ [end-punctuation]: https://cirosantilli.com/markdown-style-guide#punctuation-at-the-end-of-headers
1021
+ [html-entity-references]: https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
958
1022
 
959
1023
  <a name="md027"></a>
960
1024
 
961
- ## MD027 - Multiple spaces after blockquote symbol
1025
+ ## `MD027` - Multiple spaces after blockquote symbol
962
1026
 
963
- Tags: blockquote, whitespace, indentation
1027
+ Tags: `blockquote`, `indentation`, `whitespace`
964
1028
 
965
- Aliases: no-multiple-space-blockquote
1029
+ Aliases: `no-multiple-space-blockquote`
966
1030
 
967
- Fixable: Most violations can be fixed by tooling
1031
+ Fixable: Some violations can be fixed by tooling
968
1032
 
969
1033
  This rule is triggered when blockquotes have more than one space after the
970
1034
  blockquote (`>`) symbol:
@@ -985,11 +1049,11 @@ Rationale: Consistent formatting makes it easier to understand a document.
985
1049
 
986
1050
  <a name="md028"></a>
987
1051
 
988
- ## MD028 - Blank line inside blockquote
1052
+ ## `MD028` - Blank line inside blockquote
989
1053
 
990
- Tags: blockquote, whitespace
1054
+ Tags: `blockquote`, `whitespace`
991
1055
 
992
- Aliases: no-blanks-blockquote
1056
+ Aliases: `no-blanks-blockquote`
993
1057
 
994
1058
  This rule is triggered when two blockquote blocks are separated by nothing
995
1059
  except for a blank line:
@@ -1028,13 +1092,16 @@ separate blockquotes.
1028
1092
 
1029
1093
  <a name="md029"></a>
1030
1094
 
1031
- ## MD029 - Ordered list item prefix
1095
+ ## `MD029` - Ordered list item prefix
1096
+
1097
+ Tags: `ol`
1032
1098
 
1033
- Tags: ol
1099
+ Aliases: `ol-prefix`
1034
1100
 
1035
- Aliases: ol-prefix
1101
+ Parameters:
1036
1102
 
1037
- Parameters: style ("one", "ordered", "one_or_ordered", "zero"; default "one_or_ordered")
1103
+ - `style`: List style (`string`, default `one_or_ordered`, values `one` /
1104
+ `one_or_ordered` / `ordered` / `zero`)
1038
1105
 
1039
1106
  This rule is triggered for ordered lists that do not either start with '1.' or
1040
1107
  do not have a prefix that increases in numerical order (depending on the
@@ -1126,15 +1193,23 @@ Rationale: Consistent formatting makes it easier to understand a document.
1126
1193
 
1127
1194
  <a name="md030"></a>
1128
1195
 
1129
- ## MD030 - Spaces after list markers
1196
+ ## `MD030` - Spaces after list markers
1130
1197
 
1131
- Tags: ol, ul, whitespace
1198
+ Tags: `ol`, `ul`, `whitespace`
1132
1199
 
1133
- Aliases: list-marker-space
1200
+ Aliases: `list-marker-space`
1134
1201
 
1135
- Parameters: ul_single, ol_single, ul_multi, ol_multi (number; default 1)
1202
+ Parameters:
1136
1203
 
1137
- Fixable: Most violations can be fixed by tooling
1204
+ - `ol_multi`: Spaces for multi-line ordered list items (`integer`, default `1`)
1205
+ - `ol_single`: Spaces for single-line ordered list items (`integer`, default
1206
+ `1`)
1207
+ - `ul_multi`: Spaces for multi-line unordered list items (`integer`, default
1208
+ `1`)
1209
+ - `ul_single`: Spaces for single-line unordered list items (`integer`, default
1210
+ `1`)
1211
+
1212
+ Fixable: Some violations can be fixed by tooling
1138
1213
 
1139
1214
  This rule checks for the number of spaces between a list marker (e.g. '`-`',
1140
1215
  '`*`', '`+`' or '`1.`') and the text of the list item.
@@ -1203,15 +1278,17 @@ Note: See [Prettier.md](Prettier.md) for compatibility information.
1203
1278
 
1204
1279
  <a name="md031"></a>
1205
1280
 
1206
- ## MD031 - Fenced code blocks should be surrounded by blank lines
1281
+ ## `MD031` - Fenced code blocks should be surrounded by blank lines
1282
+
1283
+ Tags: `blank_lines`, `code`
1207
1284
 
1208
- Tags: code, blank_lines
1285
+ Aliases: `blanks-around-fences`
1209
1286
 
1210
- Aliases: blanks-around-fences
1287
+ Parameters:
1211
1288
 
1212
- Parameters: list_items (boolean; default true)
1289
+ - `list_items`: Include list items (`boolean`, default `true`)
1213
1290
 
1214
- Fixable: Most violations can be fixed by tooling
1291
+ Fixable: Some violations can be fixed by tooling
1215
1292
 
1216
1293
  This rule is triggered when fenced code blocks are either not preceded or not
1217
1294
  followed by a blank line:
@@ -1254,13 +1331,13 @@ not parse fenced code blocks that don't have blank lines before and after them.
1254
1331
 
1255
1332
  <a name="md032"></a>
1256
1333
 
1257
- ## MD032 - Lists should be surrounded by blank lines
1334
+ ## `MD032` - Lists should be surrounded by blank lines
1258
1335
 
1259
- Tags: bullet, ul, ol, blank_lines
1336
+ Tags: `blank_lines`, `bullet`, `ol`, `ul`
1260
1337
 
1261
- Aliases: blanks-around-lists
1338
+ Aliases: `blanks-around-lists`
1262
1339
 
1263
- Fixable: Most violations can be fixed by tooling
1340
+ Fixable: Some violations can be fixed by tooling
1264
1341
 
1265
1342
  This rule is triggered when lists (of any kind) are either not preceded or not
1266
1343
  followed by a blank line:
@@ -1295,13 +1372,15 @@ not parse lists that don't have blank lines before and after them.
1295
1372
 
1296
1373
  <a name="md033"></a>
1297
1374
 
1298
- ## MD033 - Inline HTML
1375
+ ## `MD033` - Inline HTML
1299
1376
 
1300
- Tags: html
1377
+ Tags: `html`
1301
1378
 
1302
- Aliases: no-inline-html
1379
+ Aliases: `no-inline-html`
1303
1380
 
1304
- Parameters: allowed_elements (array of string; default empty)
1381
+ Parameters:
1382
+
1383
+ - `allowed_elements`: Allowed elements (`string[]`, default `[]`)
1305
1384
 
1306
1385
  This rule is triggered whenever raw HTML is used in a Markdown document:
1307
1386
 
@@ -1323,61 +1402,68 @@ who are rendering Markdown documents into something other than HTML.
1323
1402
 
1324
1403
  <a name="md034"></a>
1325
1404
 
1326
- ## MD034 - Bare URL used
1405
+ ## `MD034` - Bare URL used
1327
1406
 
1328
- Tags: links, url
1407
+ Tags: `links`, `url`
1329
1408
 
1330
- Aliases: no-bare-urls
1409
+ Aliases: `no-bare-urls`
1331
1410
 
1332
- Fixable: Most violations can be fixed by tooling
1411
+ Fixable: Some violations can be fixed by tooling
1333
1412
 
1334
- This rule is triggered whenever a URL is given that isn't surrounded by angle
1335
- brackets:
1413
+ This rule is triggered whenever a URL or email address appears without
1414
+ surrounding angle brackets:
1336
1415
 
1337
1416
  ```markdown
1338
- For more information, see https://www.example.com/.
1417
+ For more info, visit https://www.example.com/ or email user@example.com.
1339
1418
  ```
1340
1419
 
1341
- To fix this, add angle brackets around the URL:
1420
+ To fix this, add angle brackets around the URL or email address:
1342
1421
 
1343
1422
  ```markdown
1344
- For more information, see <https://www.example.com/>.
1423
+ For more info, visit <https://www.example.com/> or email <user@example.com>.
1345
1424
  ```
1346
1425
 
1347
- Note: To use a bare URL without it being converted into a link, enclose it in
1348
- a code block, otherwise in some Markdown parsers it *will* be converted:
1426
+ Note: To include a bare URL or email without it being converted into a link,
1427
+ wrap it in a code span:
1349
1428
 
1350
1429
  ```markdown
1351
- `https://www.example.com`
1430
+ Not a clickable link: `https://www.example.com`
1352
1431
  ```
1353
1432
 
1354
- Note: The following scenario does *not* trigger this rule to avoid conflicts
1355
- with `MD011`/`no-reversed-links`:
1433
+ Note: The following scenario does not trigger this rule because it could be a
1434
+ shortcut link:
1356
1435
 
1357
1436
  ```markdown
1358
1437
  [https://www.example.com]
1359
1438
  ```
1360
1439
 
1361
- The use of quotes around a bare link will *not* trigger this rule, either:
1440
+ Note: The following syntax triggers this rule because the nested link could be
1441
+ a shortcut link (which takes precedence):
1362
1442
 
1363
1443
  ```markdown
1364
- "https://www.example.com"
1365
- 'https://www.example.com'
1444
+ [text [shortcut] text](https://example.com)
1366
1445
  ```
1367
1446
 
1368
- Rationale: Without angle brackets, the URL isn't converted into a link by many
1369
- Markdown parsers.
1447
+ To avoid this, escape both inner brackets:
1448
+
1449
+ ```markdown
1450
+ [link \[text\] link](https://example.com)
1451
+ ```
1452
+
1453
+ Rationale: Without angle brackets, a bare URL or email isn't converted into a
1454
+ link by some Markdown parsers.
1370
1455
 
1371
1456
  <a name="md035"></a>
1372
1457
 
1373
- ## MD035 - Horizontal rule style
1458
+ ## `MD035` - Horizontal rule style
1374
1459
 
1375
- Tags: hr
1460
+ Tags: `hr`
1376
1461
 
1377
- Aliases: hr-style
1462
+ Aliases: `hr-style`
1378
1463
 
1379
- Parameters: style ("consistent", "---", "***", "___", or other string specifying
1380
- the horizontal rule; default "consistent")
1464
+ Parameters:
1465
+
1466
+ - `style`: Horizontal rule style (`string`, default `consistent`)
1381
1467
 
1382
1468
  This rule is triggered when inconsistent styles of horizontal rules are used
1383
1469
  in the document:
@@ -1414,13 +1500,15 @@ Rationale: Consistent formatting makes it easier to understand a document.
1414
1500
 
1415
1501
  <a name="md036"></a>
1416
1502
 
1417
- ## MD036 - Emphasis used instead of a heading
1503
+ ## `MD036` - Emphasis used instead of a heading
1504
+
1505
+ Tags: `emphasis`, `headers`, `headings`
1418
1506
 
1419
- Tags: headings, headers, emphasis
1507
+ Aliases: `no-emphasis-as-header`, `no-emphasis-as-heading`
1420
1508
 
1421
- Aliases: no-emphasis-as-heading, no-emphasis-as-header
1509
+ Parameters:
1422
1510
 
1423
- Parameters: punctuation (string; default ".,;:!?。,;:!?")
1511
+ - `punctuation`: Punctuation characters (`string`, default `.,;:!?。,;:!?`)
1424
1512
 
1425
1513
  This check looks for instances where emphasized (i.e. bold or italic) text is
1426
1514
  used to separate sections, where a heading should be used instead:
@@ -1460,13 +1548,13 @@ the structure of a document. More information:
1460
1548
 
1461
1549
  <a name="md037"></a>
1462
1550
 
1463
- ## MD037 - Spaces inside emphasis markers
1551
+ ## `MD037` - Spaces inside emphasis markers
1464
1552
 
1465
- Tags: whitespace, emphasis
1553
+ Tags: `emphasis`, `whitespace`
1466
1554
 
1467
- Aliases: no-space-in-emphasis
1555
+ Aliases: `no-space-in-emphasis`
1468
1556
 
1469
- Fixable: Most violations can be fixed by tooling
1557
+ Fixable: Some violations can be fixed by tooling
1470
1558
 
1471
1559
  This rule is triggered when emphasis markers (bold, italic) are used, but they
1472
1560
  have spaces between the markers and the text:
@@ -1500,13 +1588,13 @@ intended by the author.
1500
1588
 
1501
1589
  <a name="md038"></a>
1502
1590
 
1503
- ## MD038 - Spaces inside code span elements
1591
+ ## `MD038` - Spaces inside code span elements
1504
1592
 
1505
- Tags: whitespace, code
1593
+ Tags: `code`, `whitespace`
1506
1594
 
1507
- Aliases: no-space-in-code
1595
+ Aliases: `no-space-in-code`
1508
1596
 
1509
- Fixable: Most violations can be fixed by tooling
1597
+ Fixable: Some violations can be fixed by tooling
1510
1598
 
1511
1599
  This rule is triggered for code span elements that have spaces adjacent to the
1512
1600
  backticks:
@@ -1524,30 +1612,32 @@ To fix this, remove any spaces adjacent to the backticks:
1524
1612
  ```
1525
1613
 
1526
1614
  Note: A single leading and trailing space is allowed by the specification and
1527
- automatically trimmed (to allow for embedded backticks):
1615
+ automatically trimmed (in order to allow for code spans that embed backticks):
1528
1616
 
1529
1617
  ```markdown
1530
1618
  `` `backticks` ``
1531
1619
  ```
1532
1620
 
1533
- Note: A single leading or trailing space is allowed if used to separate code span
1534
- markers from an embedded backtick:
1621
+ Note: A single leading or trailing space is allowed if used to separate code
1622
+ span markers from an embedded backtick (though the space is not trimmed):
1535
1623
 
1536
1624
  ```markdown
1537
1625
  `` ` embedded backtick``
1538
1626
  ```
1539
1627
 
1540
- Rationale: Violations of this rule can lead to improperly rendered content.
1628
+ Rationale: Violations of this rule are usually unintentional and may lead to
1629
+ improperly-rendered content. If spaces beside backticks are intentional, this
1630
+ rule can be disabled for that line or file.
1541
1631
 
1542
1632
  <a name="md039"></a>
1543
1633
 
1544
- ## MD039 - Spaces inside link text
1634
+ ## `MD039` - Spaces inside link text
1545
1635
 
1546
- Tags: whitespace, links
1636
+ Tags: `links`, `whitespace`
1547
1637
 
1548
- Aliases: no-space-in-links
1638
+ Aliases: `no-space-in-links`
1549
1639
 
1550
- Fixable: Most violations can be fixed by tooling
1640
+ Fixable: Some violations can be fixed by tooling
1551
1641
 
1552
1642
  This rule is triggered on links that have spaces surrounding the link text:
1553
1643
 
@@ -1565,11 +1655,16 @@ Rationale: Consistent formatting makes it easier to understand a document.
1565
1655
 
1566
1656
  <a name="md040"></a>
1567
1657
 
1568
- ## MD040 - Fenced code blocks should have a language specified
1658
+ ## `MD040` - Fenced code blocks should have a language specified
1659
+
1660
+ Tags: `code`, `language`
1569
1661
 
1570
- Tags: code, language
1662
+ Aliases: `fenced-code-language`
1571
1663
 
1572
- Aliases: fenced-code-language
1664
+ Parameters:
1665
+
1666
+ - `allowed_languages`: List of languages (`string[]`, default `[]`)
1667
+ - `language_only`: Require language only (`boolean`, default `false`)
1573
1668
 
1574
1669
  This rule is triggered when fenced code blocks are used, but a language isn't
1575
1670
  specified:
@@ -1598,19 +1693,34 @@ Plain text in a code block
1598
1693
  ```
1599
1694
  ````
1600
1695
 
1696
+ You can configure the `allowed_languages` parameter to specify a list of
1697
+ languages code blocks could use. Languages are case sensitive. The default value
1698
+ is `[]` which means any language specifier is valid.
1699
+
1700
+ You can prevent extra data from being present in the info string of fenced code
1701
+ blocks. To do so, set the `language_only` parameter to `true`.
1702
+
1703
+ <!-- markdownlint-disable-next-line no-space-in-code -->
1704
+ Info strings with leading/trailing whitespace (ex: `js `) or other content (ex:
1705
+ `ruby startline=3`) will trigger this rule.
1706
+
1601
1707
  Rationale: Specifying a language improves content rendering by using the
1602
1708
  correct syntax highlighting for code. More information:
1603
1709
  <https://cirosantilli.com/markdown-style-guide#option-code-fenced>.
1604
1710
 
1605
1711
  <a name="md041"></a>
1606
1712
 
1607
- ## MD041 - First line in a file should be a top-level heading
1713
+ ## `MD041` - First line in a file should be a top-level heading
1608
1714
 
1609
- Tags: headings, headers
1715
+ Tags: `headers`, `headings`
1610
1716
 
1611
- Aliases: first-line-heading, first-line-h1
1717
+ Aliases: `first-line-h1`, `first-line-heading`
1612
1718
 
1613
- Parameters: level, front_matter_title (number; default 1, string; default "^\s*"?title"?\s*[:=]")
1719
+ Parameters:
1720
+
1721
+ - `front_matter_title`: RegExp for matching title in front matter (`string`,
1722
+ default `^\s*title\s*[:=]`)
1723
+ - `level`: Heading level (`integer`, default `1`)
1614
1724
 
1615
1725
  This rule is intended to ensure documents have a title and is triggered when
1616
1726
  the first line in the file isn't a top-level (h1) heading:
@@ -1637,25 +1747,26 @@ permitted by this rule. For example:
1637
1747
  This is a file with a top-level HTML heading
1638
1748
  ```
1639
1749
 
1640
- Note: The `level` parameter can be used to change the top-level (ex: to h2) in cases
1641
- where an h1 is added externally.
1750
+ Note: The `level` parameter can be used to change the top-level (ex: to h2) in
1751
+ cases where an h1 is added externally.
1642
1752
 
1643
1753
  If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
1644
1754
  contains a `title` property (commonly used with blog posts), this rule will not
1645
1755
  report a violation. To use a different property name in the front matter,
1646
1756
  specify the text of a regular expression via the `front_matter_title` parameter.
1647
- To disable the use of front matter by this rule, specify `""` for `front_matter_title`.
1757
+ To disable the use of front matter by this rule, specify `""` for
1758
+ `front_matter_title`.
1648
1759
 
1649
1760
  Rationale: The top-level heading often acts as the title of a document. More
1650
1761
  information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
1651
1762
 
1652
1763
  <a name="md042"></a>
1653
1764
 
1654
- ## MD042 - No empty links
1765
+ ## `MD042` - No empty links
1655
1766
 
1656
- Tags: links
1767
+ Tags: `links`
1657
1768
 
1658
- Aliases: no-empty-links
1769
+ Aliases: `no-empty-links`
1659
1770
 
1660
1771
  This rule is triggered when an empty link is encountered:
1661
1772
 
@@ -1681,17 +1792,22 @@ But non-empty fragments will not:
1681
1792
  [a valid fragment](#fragment)
1682
1793
  ```
1683
1794
 
1684
- Rationale: Empty links do not lead anywhere and therefore don't function as links.
1795
+ Rationale: Empty links do not lead anywhere and therefore don't function as
1796
+ links.
1685
1797
 
1686
1798
  <a name="md043"></a>
1687
1799
 
1688
- ## MD043 - Required heading structure
1800
+ ## `MD043` - Required heading structure
1801
+
1802
+ Tags: `headers`, `headings`
1689
1803
 
1690
- Tags: headings, headers
1804
+ Aliases: `required-headers`, `required-headings`
1691
1805
 
1692
- Aliases: required-headings, required-headers
1806
+ Parameters:
1693
1807
 
1694
- Parameters: headings, headers (array of string; default `null` for disabled)
1808
+ - `headers`: List of headings (`string[]`, default `[]`)
1809
+ - `headings`: List of headings (`string[]`, default `[]`)
1810
+ - `match_case`: Match case of headings (`boolean`, default `false`)
1695
1811
 
1696
1812
  > If `headings` is not provided, `headers` (deprecated) will be used.
1697
1813
 
@@ -1744,31 +1860,40 @@ special value `"+"` meaning "one or more unspecified headings" and set the
1744
1860
  When an error is detected, this rule outputs the line number of the first
1745
1861
  problematic heading (otherwise, it outputs the last line number of the file).
1746
1862
 
1747
- Note that while the `headings` parameter uses the "## Text" ATX heading style for
1748
- simplicity, a file may use any supported heading style.
1863
+ Note that while the `headings` parameter uses the "## Text" ATX heading style
1864
+ for simplicity, a file may use any supported heading style.
1865
+
1866
+ By default, the case of headings in the document is not required to match that
1867
+ of `headings`. To require that case match exactly, set the `match_case`
1868
+ parameter to `true`.
1749
1869
 
1750
1870
  Rationale: Projects may wish to enforce a consistent document structure across
1751
1871
  a set of similar content.
1752
1872
 
1753
1873
  <a name="md044"></a>
1754
1874
 
1755
- ## MD044 - Proper names should have the correct capitalization
1875
+ ## `MD044` - Proper names should have the correct capitalization
1876
+
1877
+ Tags: `spelling`
1756
1878
 
1757
- Tags: spelling
1879
+ Aliases: `proper-names`
1758
1880
 
1759
- Aliases: proper-names
1881
+ Parameters:
1760
1882
 
1761
- Parameters: names, code_blocks, html_elements (string array; default `null`, boolean; default `true`, boolean; default `true`)
1883
+ - `code_blocks`: Include code blocks (`boolean`, default `true`)
1884
+ - `html_elements`: Include HTML elements (`boolean`, default `true`)
1885
+ - `names`: List of proper names (`string[]`, default `[]`)
1762
1886
 
1763
- Fixable: Most violations can be fixed by tooling
1887
+ Fixable: Some violations can be fixed by tooling
1764
1888
 
1765
1889
  This rule is triggered when any of the strings in the `names` array do not have
1766
1890
  the specified capitalization. It can be used to enforce a standard letter case
1767
1891
  for the names of projects and products.
1768
1892
 
1769
1893
  For example, the language "JavaScript" is usually written with both the 'J' and
1770
- 'S' capitalized - though sometimes the 's' or 'j' appear in lower-case. To enforce
1771
- the proper capitalization, specify the desired letter case in the `names` array:
1894
+ 'S' capitalized - though sometimes the 's' or 'j' appear in lower-case. To
1895
+ enforce the proper capitalization, specify the desired letter case in the
1896
+ `names` array:
1772
1897
 
1773
1898
  ```json
1774
1899
  [
@@ -1785,13 +1910,14 @@ Rationale: Incorrect capitalization of proper names is usually a mistake.
1785
1910
 
1786
1911
  <a name="md045"></a>
1787
1912
 
1788
- ## MD045 - Images should have alternate text (alt text)
1913
+ ## `MD045` - Images should have alternate text (alt text)
1789
1914
 
1790
- Tags: accessibility, images
1915
+ Tags: `accessibility`, `images`
1791
1916
 
1792
- Aliases: no-alt-text
1917
+ Aliases: `no-alt-text`
1793
1918
 
1794
- This rule is triggered when an image is missing alternate text (alt text) information.
1919
+ This rule is triggered when an image is missing alternate text (alt text)
1920
+ information.
1795
1921
 
1796
1922
  Alternate text is commonly specified inline as:
1797
1923
 
@@ -1809,27 +1935,34 @@ Or with reference syntax as:
1809
1935
  [ref]: image.jpg "Optional title"
1810
1936
  ```
1811
1937
 
1812
- Guidance for writing alternate text is available from the [W3C](https://www.w3.org/WAI/alt/),
1813
- [Wikipedia](https://en.wikipedia.org/wiki/Alt_attribute), and
1814
- [other locations](https://www.phase2technology.com/blog/no-more-excuses).
1938
+ Guidance for writing alternate text is available from the [W3C][w3c],
1939
+ [Wikipedia][wikipedia], and [other locations][phase2technology].
1815
1940
 
1816
1941
  Rationale: Alternate text is important for accessibility and describes the
1817
1942
  content of an image for people who may not be able to see it.
1818
1943
 
1944
+ [phase2technology]: https://www.phase2technology.com/blog/no-more-excuses
1945
+ [w3c]: https://www.w3.org/WAI/alt/
1946
+ [wikipedia]: https://en.wikipedia.org/wiki/Alt_attribute
1947
+
1819
1948
  <a name="md046"></a>
1820
1949
 
1821
- ## MD046 - Code block style
1950
+ ## `MD046` - Code block style
1951
+
1952
+ Tags: `code`
1822
1953
 
1823
- Tags: code
1954
+ Aliases: `code-block-style`
1824
1955
 
1825
- Aliases: code-block-style
1956
+ Parameters:
1826
1957
 
1827
- Parameters: style ("consistent", "fenced", "indented"; default "consistent")
1958
+ - `style`: Block style (`string`, default `consistent`, values `consistent` /
1959
+ `fenced` / `indented`)
1828
1960
 
1829
1961
  This rule is triggered when unwanted or different code block styles are used in
1830
1962
  the same document.
1831
1963
 
1832
- In the default configuration this rule reports a violation for the following document:
1964
+ In the default configuration this rule reports a violation for the following
1965
+ document:
1833
1966
 
1834
1967
  <!-- markdownlint-disable code-block-style -->
1835
1968
 
@@ -1857,13 +1990,13 @@ Rationale: Consistent formatting makes it easier to understand a document.
1857
1990
 
1858
1991
  <a name="md047"></a>
1859
1992
 
1860
- ## MD047 - Files should end with a single newline character
1993
+ ## `MD047` - Files should end with a single newline character
1861
1994
 
1862
- Tags: blank_lines
1995
+ Tags: `blank_lines`
1863
1996
 
1864
- Aliases: single-trailing-newline
1997
+ Aliases: `single-trailing-newline`
1865
1998
 
1866
- Fixable: Most violations can be fixed by tooling
1999
+ Fixable: Some violations can be fixed by tooling
1867
2000
 
1868
2001
  This rule is triggered when there is not a single newline character at the end
1869
2002
  of a file.
@@ -1886,17 +2019,24 @@ This file ends with a newline.
1886
2019
  ```
1887
2020
 
1888
2021
  Rationale: Some programs have trouble with files that do not end with a newline.
1889
- More information: <https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file>.
2022
+
2023
+ More information: [What's the point in adding a new line to the end of a
2024
+ file?][stack-exchange]
2025
+
2026
+ [stack-exchange]: https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file
1890
2027
 
1891
2028
  <a name="md048"></a>
1892
2029
 
1893
- ## MD048 - Code fence style
2030
+ ## `MD048` - Code fence style
2031
+
2032
+ Tags: `code`
1894
2033
 
1895
- Tags: code
2034
+ Aliases: `code-fence-style`
1896
2035
 
1897
- Aliases: code-fence-style
2036
+ Parameters:
1898
2037
 
1899
- Parameters: style ("consistent", "tilde", "backtick"; default "consistent")
2038
+ - `style`: Code fence style (`string`, default `consistent`, values `backtick`
2039
+ / `consistent` / `tilde`)
1900
2040
 
1901
2041
  This rule is triggered when the symbols used in the document for fenced code
1902
2042
  blocks do not match the configured code fence style:
@@ -1931,15 +2071,18 @@ Rationale: Consistent formatting makes it easier to understand a document.
1931
2071
 
1932
2072
  <a name="md049"></a>
1933
2073
 
1934
- ## MD049 - Emphasis style should be consistent
2074
+ ## `MD049` - Emphasis style should be consistent
1935
2075
 
1936
- Tags: emphasis
2076
+ Tags: `emphasis`
1937
2077
 
1938
- Aliases: emphasis-style
2078
+ Aliases: `emphasis-style`
1939
2079
 
1940
- Parameters: style ("consistent", "asterisk", "underscore"; default "consistent")
2080
+ Parameters:
1941
2081
 
1942
- Fixable: Most violations can be fixed by tooling
2082
+ - `style`: Emphasis style should be consistent (`string`, default `consistent`,
2083
+ values `asterisk` / `consistent` / `underscore`)
2084
+
2085
+ Fixable: Some violations can be fixed by tooling
1943
2086
 
1944
2087
  This rule is triggered when the symbols used in the document for emphasis do not
1945
2088
  match the configured emphasis style:
@@ -1963,15 +2106,18 @@ Rationale: Consistent formatting makes it easier to understand a document.
1963
2106
 
1964
2107
  <a name="md050"></a>
1965
2108
 
1966
- ## MD050 - Strong style should be consistent
2109
+ ## `MD050` - Strong style should be consistent
2110
+
2111
+ Tags: `emphasis`
1967
2112
 
1968
- Tags: emphasis
2113
+ Aliases: `strong-style`
1969
2114
 
1970
- Aliases: strong-style
2115
+ Parameters:
1971
2116
 
1972
- Parameters: style ("consistent", "asterisk", "underscore"; default "consistent")
2117
+ - `style`: Strong style should be consistent (`string`, default `consistent`,
2118
+ values `asterisk` / `consistent` / `underscore`)
1973
2119
 
1974
- Fixable: Most violations can be fixed by tooling
2120
+ Fixable: Some violations can be fixed by tooling
1975
2121
 
1976
2122
  This rule is triggered when the symbols used in the document for strong do not
1977
2123
  match the configured strong style:
@@ -1995,14 +2141,16 @@ Rationale: Consistent formatting makes it easier to understand a document.
1995
2141
 
1996
2142
  <a name="md051"></a>
1997
2143
 
1998
- ## MD051 - Link fragments should be valid
2144
+ ## `MD051` - Link fragments should be valid
1999
2145
 
2000
- Tags: links
2146
+ Tags: `links`
2001
2147
 
2002
- Aliases: link-fragments
2148
+ Aliases: `link-fragments`
2003
2149
 
2004
- This rule is triggered when a link fragment does not correspond to a heading
2005
- in the document:
2150
+ Fixable: Some violations can be fixed by tooling
2151
+
2152
+ This rule is triggered when a link fragment does not match any of the fragments
2153
+ that are automatically generated for headings in a document:
2006
2154
 
2007
2155
  ```markdown
2008
2156
  # Title
@@ -2010,34 +2158,47 @@ in the document:
2010
2158
  [Link](#fragment)
2011
2159
  ```
2012
2160
 
2013
- To fix the issue, change the fragment to reference an existing heading:
2161
+ To fix this issue, change the link fragment to reference an existing heading:
2014
2162
 
2015
2163
  ```markdown
2164
+ # Title
2165
+
2016
2166
  [Link](#title)
2017
2167
  ```
2018
2168
 
2019
- Alternatively, an HTML `a` tag with an `id` (or a `name`) attribute defines a
2020
- valid anchor:
2169
+ Alternatively, an HTML `a` tag with an `id` or a `name` attribute can be used to
2170
+ define a fragment:
2021
2171
 
2022
2172
  ```markdown
2023
- <a id="fragment"></a>
2173
+ <a id="bookmark"></a>
2174
+
2175
+ [Link](#bookmark)
2024
2176
  ```
2025
2177
 
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.
2178
+ An `a` tag can be useful in scenarios where a heading is not appropriate or for
2179
+ control over the text of the fragment identifier.
2180
+
2181
+ Rationale: [GitHub section links][github-section-links] are created
2182
+ automatically for every heading when Markdown content is displayed on GitHub.
2183
+ This makes it easy to link directly to different sections within a document.
2184
+ However, section links change if headings are renamed or removed. This rule
2185
+ helps identify broken section links within a document.
2029
2186
 
2030
- Note: Creating anchors for headings is not part of the CommonMark specification.
2187
+ Section links are **not** part of the CommonMark specification. This rule
2188
+ enforces the [GitHub heading algorithm][github-heading-algorithm] which is:
2189
+ convert heading to lowercase, remove punctuation, convert spaces to dashes,
2190
+ append an incrementing integer as needed for uniqueness.
2031
2191
 
2032
2192
  [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
2193
+ [github-heading-algorithm]: https://github.com/gjtorikian/html-pipeline/blob/f13a1534cb650ba17af400d1acd3a22c28004c09/lib/html/pipeline/toc_filter.rb
2033
2194
 
2034
2195
  <a name="md052"></a>
2035
2196
 
2036
- ## MD052 - Reference links and images should use a label that is defined
2197
+ ## `MD052` - Reference links and images should use a label that is defined
2037
2198
 
2038
- Tags: images, links
2199
+ Tags: `images`, `links`
2039
2200
 
2040
- Aliases: reference-links-images
2201
+ Aliases: `reference-links-images`
2041
2202
 
2042
2203
  Links and images in Markdown can provide the link destination or image source
2043
2204
  at the time of use or can define it elsewhere and use a label for reference.
@@ -2069,15 +2230,17 @@ of undefined labels for "full" and "collapsed" reference syntax.
2069
2230
 
2070
2231
  <a name="md053"></a>
2071
2232
 
2072
- ## MD053 - Link and image reference definitions should be needed
2233
+ ## `MD053` - Link and image reference definitions should be needed
2073
2234
 
2074
- Tags: images, links
2235
+ Tags: `images`, `links`
2075
2236
 
2076
- Aliases: link-image-reference-definitions
2237
+ Aliases: `link-image-reference-definitions`
2077
2238
 
2078
- Parameters: ignored_definitions (array of string; default [ "//" ])
2239
+ Parameters:
2079
2240
 
2080
- Fixable: Most violations can be fixed by tooling
2241
+ - `ignored_definitions`: Ignored definitions (`string[]`, default `["//"]`)
2242
+
2243
+ Fixable: Some violations can be fixed by tooling
2081
2244
 
2082
2245
  Links and images in Markdown can provide the link destination or image source
2083
2246
  at the time of use or can define it elsewhere and use a label for reference.
@@ -2090,7 +2253,7 @@ unnecessary:
2090
2253
 
2091
2254
  1. If a label is not referenced by any link or image in a document, that
2092
2255
  definition is unused and can be deleted.
2093
- 1. If a label is defined multiple times in a document, the first definition is
2256
+ 2. If a label is defined multiple times in a document, the first definition is
2094
2257
  used and the others can be deleted.
2095
2258
 
2096
2259
  This rule considers a reference definition to be used if any link or image
@@ -2102,7 +2265,7 @@ be ignored by setting the `ignored_definitions` parameter. The default value of
2102
2265
  this parameter ignores the following convention for adding non-HTML comments to
2103
2266
  Markdown:
2104
2267
 
2105
- ```md
2268
+ ```markdown
2106
2269
  [//]: # (This behaves like a comment)
2107
2270
  ```
2108
2271