markdownlint 0.26.2 → 0.27.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 (83) hide show
  1. package/CONTRIBUTING.md +81 -59
  2. package/README.md +424 -303
  3. package/demo/markdownlint-browser.js +374 -144
  4. package/doc/CustomRules.md +101 -50
  5. package/doc/Prettier.md +14 -10
  6. package/doc/ReleaseProcess.md +20 -0
  7. package/doc/Rules.md +453 -296
  8. package/doc/md001.md +37 -0
  9. package/doc/md002.md +37 -0
  10. package/doc/md003.md +59 -0
  11. package/doc/md004.md +49 -0
  12. package/doc/md005.md +53 -0
  13. package/doc/md006.md +46 -0
  14. package/doc/md007.md +55 -0
  15. package/doc/md009.md +51 -0
  16. package/doc/md010.md +56 -0
  17. package/doc/md011.md +30 -0
  18. package/doc/md012.md +38 -0
  19. package/doc/md013.md +60 -0
  20. package/doc/md014.md +54 -0
  21. package/doc/md018.md +27 -0
  22. package/doc/md019.md +28 -0
  23. package/doc/md020.md +29 -0
  24. package/doc/md021.md +31 -0
  25. package/doc/md022.md +46 -0
  26. package/doc/md023.md +26 -0
  27. package/doc/md024.md +47 -0
  28. package/doc/md025.md +49 -0
  29. package/doc/md026.md +41 -0
  30. package/doc/md027.md +24 -0
  31. package/doc/md028.md +40 -0
  32. package/doc/md029.md +98 -0
  33. package/doc/md030.md +82 -0
  34. package/doc/md031.md +50 -0
  35. package/doc/md032.md +38 -0
  36. package/doc/md033.md +27 -0
  37. package/doc/md034.md +44 -0
  38. package/doc/md035.md +42 -0
  39. package/doc/md036.md +45 -0
  40. package/doc/md037.md +37 -0
  41. package/doc/md038.md +40 -0
  42. package/doc/md039.md +21 -0
  43. package/doc/md040.md +52 -0
  44. package/doc/md041.md +49 -0
  45. package/doc/md042.md +32 -0
  46. package/doc/md043.md +72 -0
  47. package/doc/md044.md +35 -0
  48. package/doc/md045.md +34 -0
  49. package/doc/md046.md +40 -0
  50. package/doc/md047.md +34 -0
  51. package/doc/md048.md +41 -0
  52. package/doc/md049.md +32 -0
  53. package/doc/md050.md +32 -0
  54. package/doc/md051.md +50 -0
  55. package/doc/md052.md +33 -0
  56. package/doc/md053.md +38 -0
  57. package/helpers/README.md +35 -15
  58. package/helpers/helpers.js +204 -42
  59. package/helpers/package.json +2 -2
  60. package/lib/constants.js +8 -1
  61. package/lib/markdownlint.js +7 -7
  62. package/lib/md011.js +2 -2
  63. package/lib/md013.js +7 -6
  64. package/lib/md019.js +1 -1
  65. package/lib/md022.js +15 -3
  66. package/lib/md023.js +1 -1
  67. package/lib/md026.js +1 -1
  68. package/lib/md033.js +15 -4
  69. package/lib/md034.js +70 -45
  70. package/lib/md035.js +1 -1
  71. package/lib/md037.js +2 -2
  72. package/lib/md038.js +1 -1
  73. package/lib/md039.js +1 -1
  74. package/lib/md040.js +21 -2
  75. package/lib/md043.js +4 -2
  76. package/lib/md044.js +4 -3
  77. package/lib/md051.js +37 -5
  78. package/lib/rules.js +1 -1
  79. package/package.json +31 -21
  80. package/schema/.markdownlint.jsonc +10 -3
  81. package/schema/.markdownlint.yaml +8 -2
  82. package/schema/markdownlint-config-schema.json +27 -3
  83. 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
153
+
154
+ Tags: `bullet`, `ul`
137
155
 
138
- Tags: bullet, ul
156
+ Aliases: `ul-style`
139
157
 
140
- Aliases: ul-style
158
+ Parameters:
141
159
 
142
- Parameters: style ("consistent", "asterisk", "plus", "dash", "sublist"; default
143
- "consistent")
160
+ - `style`: List style (`string`, default `consistent`, values `asterisk` /
161
+ `consistent` / `dash` / `plus` / `sublist`)
144
162
 
145
- Fixable: Most violations can be fixed by tooling
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~~
243
261
 
244
- Tags: bullet, ul, indentation
262
+ > This rule is deprecated and provided for backward-compatibility
245
263
 
246
- Aliases: ul-start-left
264
+ Tags: `bullet`, `indentation`, `ul`
247
265
 
248
- Fixable: Most violations can be fixed by tooling
266
+ Aliases: `ul-start-left`
267
+
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
290
-
291
- Tags: bullet, ul, indentation
309
+ ## `MD007` - Unordered list indentation
292
310
 
293
- Aliases: ul-indent
311
+ Tags: `bullet`, `indentation`, `ul`
294
312
 
295
- <!-- markdownlint-disable line-length -->
313
+ Aliases: `ul-indent`
296
314
 
297
- Parameters: indent, start_indented, start_indent (number; default 2, boolean; default false, number; defaults to indent)
315
+ Parameters:
298
316
 
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
422
+
423
+ Tags: `hard_tab`, `whitespace`
394
424
 
395
- Tags: whitespace, hard_tab
425
+ Aliases: `no-hard-tabs`
396
426
 
397
- Aliases: no-hard-tabs
427
+ Parameters:
398
428
 
399
- Parameters: code_blocks, ignore_code_languages, spaces_per_tab (boolean; default true, array of string; default empty, number; default 1)
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`)
400
433
 
401
- Fixable: Most violations can be fixed by tooling
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
481
514
 
482
- Tags: whitespace, blank_lines
515
+ Tags: `blank_lines`, `whitespace`
483
516
 
484
- Aliases: no-multiple-blanks
517
+ Aliases: `no-multiple-blanks`
485
518
 
486
- Parameters: maximum (number; default 1)
519
+ Parameters:
487
520
 
488
- Fixable: Most violations can be fixed by tooling
521
+ - `maximum`: Consecutive blank lines (`integer`, default `1`)
522
+
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
520
-
521
- Tags: line_length
554
+ ## `MD013` - Line length
522
555
 
523
- Aliases: line-length
556
+ Tags: `line_length`
524
557
 
525
- <!-- markdownlint-disable line-length -->
558
+ Aliases: `line-length`
526
559
 
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))
560
+ Parameters:
528
561
 
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,13 +1402,13 @@ 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
1413
  This rule is triggered whenever a URL is given that isn't surrounded by angle
1335
1414
  brackets:
@@ -1370,14 +1449,15 @@ Markdown parsers.
1370
1449
 
1371
1450
  <a name="md035"></a>
1372
1451
 
1373
- ## MD035 - Horizontal rule style
1452
+ ## `MD035` - Horizontal rule style
1453
+
1454
+ Tags: `hr`
1374
1455
 
1375
- Tags: hr
1456
+ Aliases: `hr-style`
1376
1457
 
1377
- Aliases: hr-style
1458
+ Parameters:
1378
1459
 
1379
- Parameters: style ("consistent", "---", "***", "___", or other string specifying
1380
- the horizontal rule; default "consistent")
1460
+ - `style`: Horizontal rule style (`string`, default `consistent`)
1381
1461
 
1382
1462
  This rule is triggered when inconsistent styles of horizontal rules are used
1383
1463
  in the document:
@@ -1414,13 +1494,15 @@ Rationale: Consistent formatting makes it easier to understand a document.
1414
1494
 
1415
1495
  <a name="md036"></a>
1416
1496
 
1417
- ## MD036 - Emphasis used instead of a heading
1497
+ ## `MD036` - Emphasis used instead of a heading
1418
1498
 
1419
- Tags: headings, headers, emphasis
1499
+ Tags: `emphasis`, `headers`, `headings`
1420
1500
 
1421
- Aliases: no-emphasis-as-heading, no-emphasis-as-header
1501
+ Aliases: `no-emphasis-as-header`, `no-emphasis-as-heading`
1422
1502
 
1423
- Parameters: punctuation (string; default ".,;:!?。,;:!?")
1503
+ Parameters:
1504
+
1505
+ - `punctuation`: Punctuation characters (`string`, default `.,;:!?。,;:!?`)
1424
1506
 
1425
1507
  This check looks for instances where emphasized (i.e. bold or italic) text is
1426
1508
  used to separate sections, where a heading should be used instead:
@@ -1460,13 +1542,13 @@ the structure of a document. More information:
1460
1542
 
1461
1543
  <a name="md037"></a>
1462
1544
 
1463
- ## MD037 - Spaces inside emphasis markers
1545
+ ## `MD037` - Spaces inside emphasis markers
1464
1546
 
1465
- Tags: whitespace, emphasis
1547
+ Tags: `emphasis`, `whitespace`
1466
1548
 
1467
- Aliases: no-space-in-emphasis
1549
+ Aliases: `no-space-in-emphasis`
1468
1550
 
1469
- Fixable: Most violations can be fixed by tooling
1551
+ Fixable: Some violations can be fixed by tooling
1470
1552
 
1471
1553
  This rule is triggered when emphasis markers (bold, italic) are used, but they
1472
1554
  have spaces between the markers and the text:
@@ -1500,13 +1582,13 @@ intended by the author.
1500
1582
 
1501
1583
  <a name="md038"></a>
1502
1584
 
1503
- ## MD038 - Spaces inside code span elements
1585
+ ## `MD038` - Spaces inside code span elements
1504
1586
 
1505
- Tags: whitespace, code
1587
+ Tags: `code`, `whitespace`
1506
1588
 
1507
- Aliases: no-space-in-code
1589
+ Aliases: `no-space-in-code`
1508
1590
 
1509
- Fixable: Most violations can be fixed by tooling
1591
+ Fixable: Some violations can be fixed by tooling
1510
1592
 
1511
1593
  This rule is triggered for code span elements that have spaces adjacent to the
1512
1594
  backticks:
@@ -1524,30 +1606,32 @@ To fix this, remove any spaces adjacent to the backticks:
1524
1606
  ```
1525
1607
 
1526
1608
  Note: A single leading and trailing space is allowed by the specification and
1527
- automatically trimmed (to allow for embedded backticks):
1609
+ automatically trimmed (in order to allow for code spans that embed backticks):
1528
1610
 
1529
1611
  ```markdown
1530
1612
  `` `backticks` ``
1531
1613
  ```
1532
1614
 
1533
- Note: A single leading or trailing space is allowed if used to separate code span
1534
- markers from an embedded backtick:
1615
+ Note: A single leading or trailing space is allowed if used to separate code
1616
+ span markers from an embedded backtick (though the space is not trimmed):
1535
1617
 
1536
1618
  ```markdown
1537
1619
  `` ` embedded backtick``
1538
1620
  ```
1539
1621
 
1540
- Rationale: Violations of this rule can lead to improperly rendered content.
1622
+ Rationale: Violations of this rule are usually unintentional and may lead to
1623
+ improperly-rendered content. If spaces beside backticks are intentional, this
1624
+ rule can be disabled for that line or file.
1541
1625
 
1542
1626
  <a name="md039"></a>
1543
1627
 
1544
- ## MD039 - Spaces inside link text
1628
+ ## `MD039` - Spaces inside link text
1545
1629
 
1546
- Tags: whitespace, links
1630
+ Tags: `links`, `whitespace`
1547
1631
 
1548
- Aliases: no-space-in-links
1632
+ Aliases: `no-space-in-links`
1549
1633
 
1550
- Fixable: Most violations can be fixed by tooling
1634
+ Fixable: Some violations can be fixed by tooling
1551
1635
 
1552
1636
  This rule is triggered on links that have spaces surrounding the link text:
1553
1637
 
@@ -1565,11 +1649,16 @@ Rationale: Consistent formatting makes it easier to understand a document.
1565
1649
 
1566
1650
  <a name="md040"></a>
1567
1651
 
1568
- ## MD040 - Fenced code blocks should have a language specified
1652
+ ## `MD040` - Fenced code blocks should have a language specified
1569
1653
 
1570
- Tags: code, language
1654
+ Tags: `code`, `language`
1571
1655
 
1572
- Aliases: fenced-code-language
1656
+ Aliases: `fenced-code-language`
1657
+
1658
+ Parameters:
1659
+
1660
+ - `allowed_languages`: List of languages (`string[]`, default `[]`)
1661
+ - `language_only`: Require language only (`boolean`, default `false`)
1573
1662
 
1574
1663
  This rule is triggered when fenced code blocks are used, but a language isn't
1575
1664
  specified:
@@ -1598,19 +1687,34 @@ Plain text in a code block
1598
1687
  ```
1599
1688
  ````
1600
1689
 
1690
+ You can configure the `allowed_languages` parameter to specify a list of
1691
+ languages code blocks could use. Languages are case sensitive. The default value
1692
+ is `[]` which means any language specifier is valid.
1693
+
1694
+ You can prevent extra data from being present in the info string of fenced code
1695
+ blocks. To do so, set the `language_only` parameter to `true`.
1696
+
1697
+ <!-- markdownlint-disable-next-line no-space-in-code -->
1698
+ Info strings with leading/trailing whitespace (ex: `js `) or other content (ex:
1699
+ `ruby startline=3`) will trigger this rule.
1700
+
1601
1701
  Rationale: Specifying a language improves content rendering by using the
1602
1702
  correct syntax highlighting for code. More information:
1603
1703
  <https://cirosantilli.com/markdown-style-guide#option-code-fenced>.
1604
1704
 
1605
1705
  <a name="md041"></a>
1606
1706
 
1607
- ## MD041 - First line in a file should be a top-level heading
1707
+ ## `MD041` - First line in a file should be a top-level heading
1708
+
1709
+ Tags: `headers`, `headings`
1608
1710
 
1609
- Tags: headings, headers
1711
+ Aliases: `first-line-h1`, `first-line-heading`
1610
1712
 
1611
- Aliases: first-line-heading, first-line-h1
1713
+ Parameters:
1612
1714
 
1613
- Parameters: level, front_matter_title (number; default 1, string; default "^\s*"?title"?\s*[:=]")
1715
+ - `front_matter_title`: RegExp for matching title in front matter (`string`,
1716
+ default `^\s*title\s*[:=]`)
1717
+ - `level`: Heading level (`integer`, default `1`)
1614
1718
 
1615
1719
  This rule is intended to ensure documents have a title and is triggered when
1616
1720
  the first line in the file isn't a top-level (h1) heading:
@@ -1637,25 +1741,26 @@ permitted by this rule. For example:
1637
1741
  This is a file with a top-level HTML heading
1638
1742
  ```
1639
1743
 
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.
1744
+ Note: The `level` parameter can be used to change the top-level (ex: to h2) in
1745
+ cases where an h1 is added externally.
1642
1746
 
1643
1747
  If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
1644
1748
  contains a `title` property (commonly used with blog posts), this rule will not
1645
1749
  report a violation. To use a different property name in the front matter,
1646
1750
  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`.
1751
+ To disable the use of front matter by this rule, specify `""` for
1752
+ `front_matter_title`.
1648
1753
 
1649
1754
  Rationale: The top-level heading often acts as the title of a document. More
1650
1755
  information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
1651
1756
 
1652
1757
  <a name="md042"></a>
1653
1758
 
1654
- ## MD042 - No empty links
1759
+ ## `MD042` - No empty links
1655
1760
 
1656
- Tags: links
1761
+ Tags: `links`
1657
1762
 
1658
- Aliases: no-empty-links
1763
+ Aliases: `no-empty-links`
1659
1764
 
1660
1765
  This rule is triggered when an empty link is encountered:
1661
1766
 
@@ -1681,17 +1786,22 @@ But non-empty fragments will not:
1681
1786
  [a valid fragment](#fragment)
1682
1787
  ```
1683
1788
 
1684
- Rationale: Empty links do not lead anywhere and therefore don't function as links.
1789
+ Rationale: Empty links do not lead anywhere and therefore don't function as
1790
+ links.
1685
1791
 
1686
1792
  <a name="md043"></a>
1687
1793
 
1688
- ## MD043 - Required heading structure
1794
+ ## `MD043` - Required heading structure
1689
1795
 
1690
- Tags: headings, headers
1796
+ Tags: `headers`, `headings`
1691
1797
 
1692
- Aliases: required-headings, required-headers
1798
+ Aliases: `required-headers`, `required-headings`
1693
1799
 
1694
- Parameters: headings, headers (array of string; default `null` for disabled)
1800
+ Parameters:
1801
+
1802
+ - `headers`: List of headings (`string[]`, default `[]`)
1803
+ - `headings`: List of headings (`string[]`, default `[]`)
1804
+ - `match_case`: Match case of headings (`boolean`, default `false`)
1695
1805
 
1696
1806
  > If `headings` is not provided, `headers` (deprecated) will be used.
1697
1807
 
@@ -1744,31 +1854,40 @@ special value `"+"` meaning "one or more unspecified headings" and set the
1744
1854
  When an error is detected, this rule outputs the line number of the first
1745
1855
  problematic heading (otherwise, it outputs the last line number of the file).
1746
1856
 
1747
- Note that while the `headings` parameter uses the "## Text" ATX heading style for
1748
- simplicity, a file may use any supported heading style.
1857
+ Note that while the `headings` parameter uses the "## Text" ATX heading style
1858
+ for simplicity, a file may use any supported heading style.
1859
+
1860
+ By default, the case of headings in the document is not required to match that
1861
+ of `headings`. To require that case match exactly, set the `match_case`
1862
+ parameter to `true`.
1749
1863
 
1750
1864
  Rationale: Projects may wish to enforce a consistent document structure across
1751
1865
  a set of similar content.
1752
1866
 
1753
1867
  <a name="md044"></a>
1754
1868
 
1755
- ## MD044 - Proper names should have the correct capitalization
1869
+ ## `MD044` - Proper names should have the correct capitalization
1756
1870
 
1757
- Tags: spelling
1871
+ Tags: `spelling`
1758
1872
 
1759
- Aliases: proper-names
1873
+ Aliases: `proper-names`
1760
1874
 
1761
- Parameters: names, code_blocks, html_elements (string array; default `null`, boolean; default `true`, boolean; default `true`)
1875
+ Parameters:
1762
1876
 
1763
- Fixable: Most violations can be fixed by tooling
1877
+ - `code_blocks`: Include code blocks (`boolean`, default `true`)
1878
+ - `html_elements`: Include HTML elements (`boolean`, default `true`)
1879
+ - `names`: List of proper names (`string[]`, default `[]`)
1880
+
1881
+ Fixable: Some violations can be fixed by tooling
1764
1882
 
1765
1883
  This rule is triggered when any of the strings in the `names` array do not have
1766
1884
  the specified capitalization. It can be used to enforce a standard letter case
1767
1885
  for the names of projects and products.
1768
1886
 
1769
1887
  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:
1888
+ 'S' capitalized - though sometimes the 's' or 'j' appear in lower-case. To
1889
+ enforce the proper capitalization, specify the desired letter case in the
1890
+ `names` array:
1772
1891
 
1773
1892
  ```json
1774
1893
  [
@@ -1785,13 +1904,14 @@ Rationale: Incorrect capitalization of proper names is usually a mistake.
1785
1904
 
1786
1905
  <a name="md045"></a>
1787
1906
 
1788
- ## MD045 - Images should have alternate text (alt text)
1907
+ ## `MD045` - Images should have alternate text (alt text)
1789
1908
 
1790
- Tags: accessibility, images
1909
+ Tags: `accessibility`, `images`
1791
1910
 
1792
- Aliases: no-alt-text
1911
+ Aliases: `no-alt-text`
1793
1912
 
1794
- This rule is triggered when an image is missing alternate text (alt text) information.
1913
+ This rule is triggered when an image is missing alternate text (alt text)
1914
+ information.
1795
1915
 
1796
1916
  Alternate text is commonly specified inline as:
1797
1917
 
@@ -1809,27 +1929,34 @@ Or with reference syntax as:
1809
1929
  [ref]: image.jpg "Optional title"
1810
1930
  ```
1811
1931
 
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).
1932
+ Guidance for writing alternate text is available from the [W3C][w3c],
1933
+ [Wikipedia][wikipedia], and [other locations][phase2technology].
1815
1934
 
1816
1935
  Rationale: Alternate text is important for accessibility and describes the
1817
1936
  content of an image for people who may not be able to see it.
1818
1937
 
1938
+ [phase2technology]: https://www.phase2technology.com/blog/no-more-excuses
1939
+ [w3c]: https://www.w3.org/WAI/alt/
1940
+ [wikipedia]: https://en.wikipedia.org/wiki/Alt_attribute
1941
+
1819
1942
  <a name="md046"></a>
1820
1943
 
1821
- ## MD046 - Code block style
1944
+ ## `MD046` - Code block style
1822
1945
 
1823
- Tags: code
1946
+ Tags: `code`
1824
1947
 
1825
- Aliases: code-block-style
1948
+ Aliases: `code-block-style`
1826
1949
 
1827
- Parameters: style ("consistent", "fenced", "indented"; default "consistent")
1950
+ Parameters:
1951
+
1952
+ - `style`: Block style (`string`, default `consistent`, values `consistent` /
1953
+ `fenced` / `indented`)
1828
1954
 
1829
1955
  This rule is triggered when unwanted or different code block styles are used in
1830
1956
  the same document.
1831
1957
 
1832
- In the default configuration this rule reports a violation for the following document:
1958
+ In the default configuration this rule reports a violation for the following
1959
+ document:
1833
1960
 
1834
1961
  <!-- markdownlint-disable code-block-style -->
1835
1962
 
@@ -1857,13 +1984,13 @@ Rationale: Consistent formatting makes it easier to understand a document.
1857
1984
 
1858
1985
  <a name="md047"></a>
1859
1986
 
1860
- ## MD047 - Files should end with a single newline character
1987
+ ## `MD047` - Files should end with a single newline character
1861
1988
 
1862
- Tags: blank_lines
1989
+ Tags: `blank_lines`
1863
1990
 
1864
- Aliases: single-trailing-newline
1991
+ Aliases: `single-trailing-newline`
1865
1992
 
1866
- Fixable: Most violations can be fixed by tooling
1993
+ Fixable: Some violations can be fixed by tooling
1867
1994
 
1868
1995
  This rule is triggered when there is not a single newline character at the end
1869
1996
  of a file.
@@ -1886,17 +2013,24 @@ This file ends with a newline.
1886
2013
  ```
1887
2014
 
1888
2015
  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>.
2016
+
2017
+ More information: [What's the point in adding a new line to the end of a
2018
+ file?][stack-exchange]
2019
+
2020
+ [stack-exchange]: https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file
1890
2021
 
1891
2022
  <a name="md048"></a>
1892
2023
 
1893
- ## MD048 - Code fence style
2024
+ ## `MD048` - Code fence style
1894
2025
 
1895
- Tags: code
2026
+ Tags: `code`
1896
2027
 
1897
- Aliases: code-fence-style
2028
+ Aliases: `code-fence-style`
1898
2029
 
1899
- Parameters: style ("consistent", "tilde", "backtick"; default "consistent")
2030
+ Parameters:
2031
+
2032
+ - `style`: Code fence style (`string`, default `consistent`, values `backtick`
2033
+ / `consistent` / `tilde`)
1900
2034
 
1901
2035
  This rule is triggered when the symbols used in the document for fenced code
1902
2036
  blocks do not match the configured code fence style:
@@ -1931,15 +2065,18 @@ Rationale: Consistent formatting makes it easier to understand a document.
1931
2065
 
1932
2066
  <a name="md049"></a>
1933
2067
 
1934
- ## MD049 - Emphasis style should be consistent
2068
+ ## `MD049` - Emphasis style should be consistent
2069
+
2070
+ Tags: `emphasis`
1935
2071
 
1936
- Tags: emphasis
2072
+ Aliases: `emphasis-style`
1937
2073
 
1938
- Aliases: emphasis-style
2074
+ Parameters:
1939
2075
 
1940
- Parameters: style ("consistent", "asterisk", "underscore"; default "consistent")
2076
+ - `style`: Emphasis style should be consistent (`string`, default `consistent`,
2077
+ values `asterisk` / `consistent` / `underscore`)
1941
2078
 
1942
- Fixable: Most violations can be fixed by tooling
2079
+ Fixable: Some violations can be fixed by tooling
1943
2080
 
1944
2081
  This rule is triggered when the symbols used in the document for emphasis do not
1945
2082
  match the configured emphasis style:
@@ -1963,15 +2100,18 @@ Rationale: Consistent formatting makes it easier to understand a document.
1963
2100
 
1964
2101
  <a name="md050"></a>
1965
2102
 
1966
- ## MD050 - Strong style should be consistent
2103
+ ## `MD050` - Strong style should be consistent
1967
2104
 
1968
- Tags: emphasis
2105
+ Tags: `emphasis`
1969
2106
 
1970
- Aliases: strong-style
2107
+ Aliases: `strong-style`
1971
2108
 
1972
- Parameters: style ("consistent", "asterisk", "underscore"; default "consistent")
2109
+ Parameters:
1973
2110
 
1974
- Fixable: Most violations can be fixed by tooling
2111
+ - `style`: Strong style should be consistent (`string`, default `consistent`,
2112
+ values `asterisk` / `consistent` / `underscore`)
2113
+
2114
+ Fixable: Some violations can be fixed by tooling
1975
2115
 
1976
2116
  This rule is triggered when the symbols used in the document for strong do not
1977
2117
  match the configured strong style:
@@ -1995,14 +2135,16 @@ Rationale: Consistent formatting makes it easier to understand a document.
1995
2135
 
1996
2136
  <a name="md051"></a>
1997
2137
 
1998
- ## MD051 - Link fragments should be valid
2138
+ ## `MD051` - Link fragments should be valid
1999
2139
 
2000
- Tags: links
2140
+ Tags: `links`
2001
2141
 
2002
- Aliases: link-fragments
2142
+ Aliases: `link-fragments`
2003
2143
 
2004
- This rule is triggered when a link fragment does not correspond to a heading
2005
- in the document:
2144
+ Fixable: Some violations can be fixed by tooling
2145
+
2146
+ This rule is triggered when a link fragment does not match any of the fragments
2147
+ that are automatically generated for headings in a document:
2006
2148
 
2007
2149
  ```markdown
2008
2150
  # Title
@@ -2010,34 +2152,47 @@ in the document:
2010
2152
  [Link](#fragment)
2011
2153
  ```
2012
2154
 
2013
- To fix the issue, change the fragment to reference an existing heading:
2155
+ To fix this issue, change the link fragment to reference an existing heading:
2014
2156
 
2015
2157
  ```markdown
2158
+ # Title
2159
+
2016
2160
  [Link](#title)
2017
2161
  ```
2018
2162
 
2019
- Alternatively, an HTML `a` tag with an `id` (or a `name`) attribute defines a
2020
- valid anchor:
2163
+ Alternatively, an HTML `a` tag with an `id` or a `name` attribute can be used to
2164
+ define a fragment:
2021
2165
 
2022
2166
  ```markdown
2023
- <a id="fragment"></a>
2167
+ <a id="bookmark"></a>
2168
+
2169
+ [Link](#bookmark)
2024
2170
  ```
2025
2171
 
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.
2172
+ An `a` tag can be useful in scenarios where a heading is not appropriate or for
2173
+ control over the text of the fragment identifier.
2029
2174
 
2030
- Note: Creating anchors for headings is not part of the CommonMark specification.
2175
+ Rationale: [GitHub section links][github-section-links] are created
2176
+ automatically for every heading when Markdown content is displayed on GitHub.
2177
+ This makes it easy to link directly to different sections within a document.
2178
+ However, section links change if headings are renamed or removed. This rule
2179
+ helps identify broken section links within a document.
2180
+
2181
+ Section links are **not** part of the CommonMark specification. This rule
2182
+ enforces the [GitHub heading algorithm][github-heading-algorithm] which is:
2183
+ convert heading to lowercase, remove punctuation, convert spaces to dashes,
2184
+ append an incrementing integer as needed for uniqueness.
2031
2185
 
2032
2186
  [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
2187
+ [github-heading-algorithm]: https://github.com/gjtorikian/html-pipeline/blob/main/lib/html/pipeline/toc_filter.rb
2033
2188
 
2034
2189
  <a name="md052"></a>
2035
2190
 
2036
- ## MD052 - Reference links and images should use a label that is defined
2191
+ ## `MD052` - Reference links and images should use a label that is defined
2037
2192
 
2038
- Tags: images, links
2193
+ Tags: `images`, `links`
2039
2194
 
2040
- Aliases: reference-links-images
2195
+ Aliases: `reference-links-images`
2041
2196
 
2042
2197
  Links and images in Markdown can provide the link destination or image source
2043
2198
  at the time of use or can define it elsewhere and use a label for reference.
@@ -2069,15 +2224,17 @@ of undefined labels for "full" and "collapsed" reference syntax.
2069
2224
 
2070
2225
  <a name="md053"></a>
2071
2226
 
2072
- ## MD053 - Link and image reference definitions should be needed
2227
+ ## `MD053` - Link and image reference definitions should be needed
2228
+
2229
+ Tags: `images`, `links`
2073
2230
 
2074
- Tags: images, links
2231
+ Aliases: `link-image-reference-definitions`
2075
2232
 
2076
- Aliases: link-image-reference-definitions
2233
+ Parameters:
2077
2234
 
2078
- Parameters: ignored_definitions (array of string; default [ "//" ])
2235
+ - `ignored_definitions`: Ignored definitions (`string[]`, default `["//"]`)
2079
2236
 
2080
- Fixable: Most violations can be fixed by tooling
2237
+ Fixable: Some violations can be fixed by tooling
2081
2238
 
2082
2239
  Links and images in Markdown can provide the link destination or image source
2083
2240
  at the time of use or can define it elsewhere and use a label for reference.
@@ -2090,7 +2247,7 @@ unnecessary:
2090
2247
 
2091
2248
  1. If a label is not referenced by any link or image in a document, that
2092
2249
  definition is unused and can be deleted.
2093
- 1. If a label is defined multiple times in a document, the first definition is
2250
+ 2. If a label is defined multiple times in a document, the first definition is
2094
2251
  used and the others can be deleted.
2095
2252
 
2096
2253
  This rule considers a reference definition to be used if any link or image
@@ -2102,7 +2259,7 @@ be ignored by setting the `ignored_definitions` parameter. The default value of
2102
2259
  this parameter ignores the following convention for adding non-HTML comments to
2103
2260
  Markdown:
2104
2261
 
2105
- ```md
2262
+ ```markdown
2106
2263
  [//]: # (This behaves like a comment)
2107
2264
  ```
2108
2265