markdownlint 0.20.2 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CONTRIBUTING.md +50 -47
  2. package/LICENSE +21 -21
  3. package/README.md +915 -871
  4. package/demo/markdownlint-browser.js +4693 -5400
  5. package/doc/CustomRules.md +315 -313
  6. package/doc/Rules.md +1868 -1795
  7. package/helpers/LICENSE +21 -21
  8. package/helpers/README.md +50 -50
  9. package/helpers/helpers.js +690 -671
  10. package/helpers/package.json +18 -18
  11. package/lib/cache.js +24 -24
  12. package/lib/markdownlint.d.ts +365 -352
  13. package/lib/markdownlint.js +1186 -1101
  14. package/lib/md001.js +22 -22
  15. package/lib/md002.js +22 -22
  16. package/lib/md003.js +42 -42
  17. package/lib/md004.js +43 -43
  18. package/lib/md005.js +69 -69
  19. package/lib/md006.js +34 -34
  20. package/lib/md007.js +47 -47
  21. package/lib/md009.js +77 -77
  22. package/lib/md010.js +38 -38
  23. package/lib/md011.js +42 -38
  24. package/lib/md012.js +32 -32
  25. package/lib/md013.js +99 -99
  26. package/lib/md014.js +53 -53
  27. package/lib/md018.js +34 -34
  28. package/lib/md019.js +39 -39
  29. package/lib/md020.js +62 -62
  30. package/lib/md021.js +60 -60
  31. package/lib/md022.js +56 -56
  32. package/lib/md023.js +38 -38
  33. package/lib/md024.js +38 -38
  34. package/lib/md025.js +32 -32
  35. package/lib/md026.js +40 -40
  36. package/lib/md027.js +56 -56
  37. package/lib/md028.js +38 -38
  38. package/lib/md029.js +66 -66
  39. package/lib/md030.js +50 -50
  40. package/lib/md031.js +40 -39
  41. package/lib/md032.js +50 -50
  42. package/lib/md033.js +45 -45
  43. package/lib/md034.js +61 -61
  44. package/lib/md035.js +21 -21
  45. package/lib/md036.js +56 -56
  46. package/lib/md037.js +150 -141
  47. package/lib/md038.js +68 -68
  48. package/lib/md039.js +64 -64
  49. package/lib/md040.js +18 -18
  50. package/lib/md041.js +31 -31
  51. package/lib/md042.js +42 -41
  52. package/lib/md043.js +45 -45
  53. package/lib/md044.js +94 -71
  54. package/lib/md045.js +18 -18
  55. package/lib/md046.js +32 -32
  56. package/lib/md047.js +28 -28
  57. package/lib/md048.js +29 -29
  58. package/lib/rules.js +60 -61
  59. package/package.json +74 -67
  60. package/schema/build-config-schema.js +409 -405
  61. package/schema/markdownlint-config-schema.json +7 -2
  62. package/style/all.json +5 -5
  63. package/style/cirosantilli.json +22 -22
  64. package/style/relaxed.json +13 -13
package/doc/Rules.md CHANGED
@@ -1,1795 +1,1868 @@
1
- # Rules
2
-
3
- This document contains a description of all rules, what they are checking for,
4
- as well as an examples of documents that break the rule and corrected
5
- versions of the examples. Any rule whose heading is ~~struck through~~ is
6
- deprecated, but still provided for backward-compatibility.
7
-
8
- <a name="md001"></a>
9
-
10
- ## MD001 - Heading levels should only increment by one level at a time
11
-
12
- Tags: headings, headers
13
-
14
- Aliases: heading-increment, header-increment
15
-
16
- This rule is triggered when you skip heading levels in a markdown document, for
17
- example:
18
-
19
- ```markdown
20
- # Heading 1
21
-
22
- ### Heading 3
23
-
24
- We skipped out a 2nd level heading in this document
25
- ```
26
-
27
- When using multiple heading levels, nested headings should increase by only one
28
- level at a time:
29
-
30
- ```markdown
31
- # Heading 1
32
-
33
- ## Heading 2
34
-
35
- ### Heading 3
36
-
37
- #### Heading 4
38
-
39
- ## Another Heading 2
40
-
41
- ### Another Heading 3
42
- ```
43
-
44
- Rationale: Headings represent the structure of a document and can be confusing
45
- when skipped - especially for accessibility scenarios. More information:
46
- <https://www.w3.org/WAI/tutorials/page-structure/headings/>.
47
-
48
- <a name="md002"></a>
49
-
50
- ## ~~MD002 - First heading should be a top level heading~~
51
-
52
- Tags: headings, headers
53
-
54
- Aliases: first-heading-h1, first-header-h1
55
-
56
- Parameters: level (number; default 1)
57
-
58
- > Note: *MD002 has been deprecated and is disabled by default.*
59
- > [MD041/first-line-heading](#md041) offers an improved implementation.
60
-
61
- This rule is intended to ensure document headings start at the top level and
62
- is triggered when the first heading in the document isn't an h1 heading:
63
-
64
- ```markdown
65
- ## This isn't an H1 heading
66
-
67
- ### Another heading
68
- ```
69
-
70
- The first heading in the document should be an h1 heading:
71
-
72
- ```markdown
73
- # Start with an H1 heading
74
-
75
- ## Then use an H2 for subsections
76
- ```
77
-
78
- Note: The `level` parameter can be used to change the top level (ex: to h2) in
79
- cases where an h1 is added externally.
80
-
81
- Rationale: The top level heading often acts as the title of a document. More
82
- information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
83
-
84
- <a name="md003"></a>
85
-
86
- ## MD003 - Heading style
87
-
88
- Tags: headings, headers
89
-
90
- Aliases: heading-style, header-style
91
-
92
- Parameters: style ("consistent", "atx", "atx_closed", "setext",
93
- "setext_with_atx", "setext_with_atx_closed"; default "consistent")
94
-
95
- This rule is triggered when different heading styles (atx, setext, and 'closed'
96
- atx) are used in the same document:
97
-
98
- ```markdown
99
- # ATX style H1
100
-
101
- ## Closed ATX style H2 ##
102
-
103
- Setext style H1
104
- ===============
105
- ```
106
-
107
- Be consistent with the style of heading used in a document:
108
-
109
- ```markdown
110
- # ATX style H1
111
-
112
- ## ATX style H2
113
- ```
114
-
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:
117
-
118
- ```markdown
119
- Setext style H1
120
- ===============
121
-
122
- Setext style H2
123
- ---------------
124
-
125
- ### ATX style H3
126
- ```
127
-
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 be consistent within the document.
131
-
132
- Rationale: Consistent formatting makes it easier to understand a document.
133
-
134
- <a name="md004"></a>
135
-
136
- ## MD004 - Unordered list style
137
-
138
- Tags: bullet, ul
139
-
140
- Aliases: ul-style
141
-
142
- Parameters: style ("consistent", "asterisk", "plus", "dash", "sublist"; default
143
- "consistent")
144
-
145
- This rule is triggered when the symbols used in the document for unordered
146
- list items do not match the configured unordered list style:
147
-
148
- ```markdown
149
- * Item 1
150
- + Item 2
151
- - Item 3
152
- ```
153
-
154
- To fix this issue, use the configured style for list items throughout the
155
- document:
156
-
157
- ```markdown
158
- * Item 1
159
- * Item 2
160
- * Item 3
161
- ```
162
-
163
- The configured list style can be a specific symbol to use (asterisk, plus, dash),
164
- can require that usage be consistent within the document, or can require that each
165
- sublist have a consistent symbol that is different from its parent list.
166
-
167
- For example, the following is valid for the `sublist` style because the outer-most
168
- indent uses asterisk, the middle indent uses plus, and the inner-most indent uses dash:
169
-
170
- ```markdown
171
- * Item 1
172
- + Item 2
173
- - Item 3
174
- + Item 4
175
- * Item 4
176
- + Item 5
177
- ```
178
-
179
- Rationale: Consistent formatting makes it easier to understand a document.
180
-
181
- <a name="md005"></a>
182
-
183
- ## MD005 - Inconsistent indentation for list items at the same level
184
-
185
- Tags: bullet, ul, indentation
186
-
187
- Aliases: list-indent
188
-
189
- This rule is triggered when list items are parsed as being at the same level,
190
- but don't have the same indentation:
191
-
192
- ```markdown
193
- * Item 1
194
- * Nested Item 1
195
- * Nested Item 2
196
- * A misaligned item
197
- ```
198
-
199
- Usually this rule will be triggered because of a typo. Correct the indentation
200
- for the list to fix it:
201
-
202
- ```markdown
203
- * Item 1
204
- * Nested Item 1
205
- * Nested Item 2
206
- * Nested Item 3
207
- ```
208
-
209
- Sequentially-ordered list markers are usually left-aligned such that all items
210
- have the same starting column:
211
-
212
- ```markdown
213
- ...
214
- 8. Item
215
- 9. Item
216
- 10. Item
217
- 11. Item
218
- ...
219
- ```
220
-
221
- This rule also supports right-alignment of list markers such that all items have
222
- the same ending column:
223
-
224
- ```markdown
225
- ...
226
- 8. Item
227
- 9. Item
228
- 10. Item
229
- 11. Item
230
- ...
231
- ```
232
-
233
- Rationale: Violations of this rule can lead to improperly rendered content.
234
-
235
- <a name="md006"></a>
236
-
237
- ## ~~MD006 - Consider starting bulleted lists at the beginning of the line~~
238
-
239
- Tags: bullet, ul, indentation
240
-
241
- Aliases: ul-start-left
242
-
243
- This rule is triggered when top level lists don't start at the beginning of a
244
- line:
245
-
246
- ```markdown
247
- Some text
248
-
249
- * List item
250
- * List item
251
- ```
252
-
253
- To fix, ensure that top level list items are not indented:
254
-
255
- ```markdown
256
- Some test
257
-
258
- * List item
259
- * List item
260
- ```
261
-
262
- Note: This rule is triggered for the following scenario because the unordered
263
- sublist is not recognized as such by the parser. Not being nested 3 characters
264
- as required by the outer ordered list, it creates a top-level unordered list
265
- instead.
266
-
267
- ```markdown
268
- 1. List item
269
- - List item
270
- - List item
271
- 1. List item
272
- ```
273
-
274
- Rationale: Starting lists at the beginning of the line means that nested list
275
- items can all be indented by the same amount when an editor's indent function
276
- or the tab key is used to indent. Starting a list 1 space in means that the
277
- indent of the first nested list is less than the indent of the second level (3
278
- characters if you use 4 space tabs, or 1 character if you use 2 space tabs).
279
-
280
- <a name="md007"></a>
281
-
282
- ## MD007 - Unordered list indentation
283
-
284
- Tags: bullet, ul, indentation
285
-
286
- Aliases: ul-indent
287
-
288
- Parameters: indent, start_indented (number; default 2, boolean; default false)
289
-
290
- This rule is triggered when list items are not indented by the configured
291
- number of spaces (default: 2).
292
-
293
- Example:
294
-
295
- ```markdown
296
- * List item
297
- * Nested list item indented by 3 spaces
298
- ```
299
-
300
- Corrected Example:
301
-
302
- ```markdown
303
- * List item
304
- * Nested list item indented by 2 spaces
305
- ```
306
-
307
- Note: This rule applies to a sublist only if its parent lists are all also
308
- unordered (otherwise, extra indentation of ordered lists interferes with the
309
- rule).
310
-
311
- The `start_indented` parameter allows the first level of lists to be indented by
312
- the configured number of spaces rather than starting at zero (the inverse of
313
- MD006).
314
-
315
- Rationale: Indenting by 2 spaces allows the content of a nested list to be in
316
- line with the start of the content of the parent list when a single space is
317
- used after the list marker. Indenting by 4 spaces is consistent with code blocks
318
- and simpler for editors to implement. Additionally, this can be a compatibility
319
- issue for multi-markdown parsers, which require a 4-space indents. More information:
320
- <https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists>
321
- and <http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting>.
322
-
323
- <a name="md009"></a>
324
-
325
- ## MD009 - Trailing spaces
326
-
327
- Tags: whitespace
328
-
329
- Aliases: no-trailing-spaces
330
-
331
- Parameters: br_spaces, list_item_empty_lines, strict (number; default 2, boolean; default false, boolean; default false)
332
-
333
- This rule is triggered on any lines that end with unexpected whitespace. To fix this,
334
- remove the trailing space from the end of the line.
335
-
336
- The `br_spaces` parameter allows an exception to this rule for a specific number
337
- of trailing spaces, typically used to insert an explicit line break. The default
338
- value allows 2 spaces to indicate a hard break (\<br> element).
339
-
340
- Note: You must set `br_spaces` to a value >= 2 for this parameter to take effect.
341
- Setting `br_spaces` to 1 behaves the same as 0, disallowing any trailing spaces.
342
-
343
- By default, this rule will not trigger when the allowed number of spaces is used,
344
- even when it doesn't create a hard break (for example, at the end of a paragraph).
345
- To report such instances as well, set the `strict` parameter to `true`.
346
-
347
- ```markdown
348
- Text text text
349
- text[2 spaces]
350
- ```
351
-
352
- Using spaces to indent blank lines inside a list item is usually not necessary,
353
- but some parsers require it. Set the `list_item_empty_lines` parameter to `true`
354
- to allow this (even when `strict` is `true`):
355
-
356
- ```markdown
357
- - list item text
358
- [2 spaces]
359
- list item text
360
- ```
361
-
362
- Rationale: Except when being used to create a line break, trailing whitespace
363
- has no purpose and does not affect the rendering of content.
364
-
365
- <a name="md010"></a>
366
-
367
- ## MD010 - Hard tabs
368
-
369
- Tags: whitespace, hard_tab
370
-
371
- Aliases: no-hard-tabs
372
-
373
- Parameters: code_blocks (boolean; default true)
374
-
375
- This rule is triggered by any lines that contain hard tab characters instead
376
- of using spaces for indentation. To fix this, replace any hard tab characters
377
- with spaces instead.
378
-
379
- Example:
380
-
381
- ```markdown
382
- Some text
383
-
384
- * hard tab character used to indent the list item
385
- ```
386
-
387
- Corrected example:
388
-
389
- ```markdown
390
- Some text
391
-
392
- * Spaces used to indent the list item instead
393
- ```
394
-
395
- You have the option to exclude this rule for code blocks. To do so, set the
396
- `code_blocks` parameter to `false`. Code blocks are included by default since
397
- handling of tabs by tools is often inconsistent (ex: using 4 vs. 8 spaces).
398
-
399
- Rationale: Hard tabs are often rendered inconsistently by different editors and
400
- can be harder to work with than spaces.
401
-
402
- <a name="md011"></a>
403
-
404
- ## MD011 - Reversed link syntax
405
-
406
- Tags: links
407
-
408
- Aliases: no-reversed-links
409
-
410
- This rule is triggered when text that appears to be a link is encountered, but
411
- where the syntax appears to have been reversed (the `[]` and `()` are
412
- reversed):
413
-
414
- ```markdown
415
- (Incorrect link syntax)[https://www.example.com/]
416
- ```
417
-
418
- To fix this, swap the `[]` and `()` around:
419
-
420
- ```markdown
421
- [Correct link syntax](https://www.example.com/)
422
- ```
423
-
424
- Note: [Markdown Extra](https://en.wikipedia.org/wiki/Markdown_Extra)-style footnotes do not trigger this rule:
425
-
426
- ```markdown
427
- For (example)[^1]
428
- ```
429
-
430
- Rationale: Reversed links are not rendered as usable links.
431
-
432
- <a name="md012"></a>
433
-
434
- ## MD012 - Multiple consecutive blank lines
435
-
436
- Tags: whitespace, blank_lines
437
-
438
- Aliases: no-multiple-blanks
439
-
440
- Parameters: maximum (number; default 1)
441
-
442
- This rule is triggered when there are multiple consecutive blank lines in the
443
- document:
444
-
445
- ```markdown
446
- Some text here
447
-
448
-
449
- Some more text here
450
- ```
451
-
452
- To fix this, delete the offending lines:
453
-
454
- ```markdown
455
- Some text here
456
-
457
- Some more text here
458
- ```
459
-
460
- Note: this rule will not be triggered if there are multiple consecutive blank
461
- lines inside code blocks.
462
-
463
- Note: The `maximum` parameter can be used to configure the maximum number of
464
- consecutive blank lines.
465
-
466
- Rationale: Except in a code block, blank lines serve no purpose and do not
467
- affect the rendering of content.
468
-
469
- <a name="md013"></a>
470
-
471
- ## MD013 - Line length
472
-
473
- Tags: line_length
474
-
475
- Aliases: line-length
476
-
477
- 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))
478
-
479
- > If `headings` is not provided, `headers` (deprecated) will be used.
480
-
481
- This rule is triggered when there are lines that are longer than the
482
- configured `line_length` (default: 80 characters). To fix this, split the line
483
- up into multiple lines. To set a different maximum length for headings, use
484
- `heading_line_length`. To set a different maximum length for code blocks, use
485
- `code_block_line_length`
486
-
487
- This rule has an exception when there is no whitespace beyond the configured
488
- line length. This allows you to still include items such as long URLs without
489
- being forced to break them in the middle. To disable this exception, set the
490
- `strict` parameter to `true` to report an issue when any line is too long.
491
- To warn for lines that are too long and could be fixed but allow lines without
492
- spaces, set the `stern` parameter to `true`.
493
-
494
- For example (assuming normal behavior):
495
-
496
- ```markdown
497
- IF THIS LINE IS THE MAXIMUM LENGTH
498
- This line is okay because there are-no-spaces-beyond-that-length
499
- And this line is a violation because there are
500
- This-line-is-also-okay-because-there-are-no-spaces
501
- ```
502
-
503
- In `strict` or `stern` modes, the two middle lines above are a violation. The
504
- third line is a violation in `strict` mode, but allowed in `stern` mode.
505
-
506
- You have the option to exclude this rule for code blocks, tables, or headings.
507
- To do so, set the `code_blocks`, `tables`, or `headings` parameter(s) to false.
508
-
509
- Code blocks are included in this rule by default since it is often a
510
- requirement for document readability, and tentatively compatible with code
511
- rules. Still, some languages do not lend themselves to short lines.
512
-
513
- Rationale: Extremely long lines can be difficult to work with in some editors.
514
- More information: <https://cirosantilli.com/markdown-style-guide#line-wrapping>.
515
-
516
- <a name="md014"></a>
517
-
518
- ## MD014 - Dollar signs used before commands without showing output
519
-
520
- Tags: code
521
-
522
- Aliases: commands-show-output
523
-
524
- This rule is triggered when there are code blocks showing shell commands to be
525
- typed, and *all* of the shell commands are preceded by dollar signs ($):
526
-
527
- ```markdown
528
- $ ls
529
- $ cat foo
530
- $ less bar
531
- ```
532
-
533
- The dollar signs are unnecessary in this situation, and should not be
534
- included:
535
-
536
- ```markdown
537
- ls
538
- cat foo
539
- less bar
540
- ```
541
-
542
- Showing output for commands preceded by dollar signs does not trigger this rule:
543
-
544
- ```markdown
545
- $ ls
546
- foo bar
547
- $ cat foo
548
- Hello world
549
- $ cat bar
550
- baz
551
- ```
552
-
553
- Because some commands do not produce output, it is not a violation if *some*
554
- commands do not have output:
555
-
556
- ```markdown
557
- $ mkdir test
558
- mkdir: created directory 'test'
559
- $ ls test
560
- ```
561
-
562
- Rationale: It is easier to copy/paste and less noisy if the dollar signs
563
- are omitted when they are not needed. See
564
- <https://cirosantilli.com/markdown-style-guide#dollar-signs-in-shell-code>
565
- for more information.
566
-
567
- <a name="md018"></a>
568
-
569
- ## MD018 - No space after hash on atx style heading
570
-
571
- Tags: headings, headers, atx, spaces
572
-
573
- Aliases: no-missing-space-atx
574
-
575
- This rule is triggered when spaces are missing after the hash characters
576
- in an atx style heading:
577
-
578
- ```markdown
579
- #Heading 1
580
-
581
- ##Heading 2
582
- ```
583
-
584
- To fix this, separate the heading text from the hash character by a single
585
- space:
586
-
587
- ```markdown
588
- # Heading 1
589
-
590
- ## Heading 2
591
- ```
592
-
593
- Rationale: Violations of this rule can lead to improperly rendered content.
594
-
595
- <a name="md019"></a>
596
-
597
- ## MD019 - Multiple spaces after hash on atx style heading
598
-
599
- Tags: headings, headers, atx, spaces
600
-
601
- Aliases: no-multiple-space-atx
602
-
603
- This rule is triggered when more than one space is used to separate the
604
- heading text from the hash characters in an atx style heading:
605
-
606
- ```markdown
607
- # Heading 1
608
-
609
- ## Heading 2
610
- ```
611
-
612
- To fix this, separate the heading text from the hash character by a single
613
- space:
614
-
615
- ```markdown
616
- # Heading 1
617
-
618
- ## Heading 2
619
- ```
620
-
621
- Rationale: Extra space has no purpose and does not affect the rendering of
622
- content.
623
-
624
- <a name="md020"></a>
625
-
626
- ## MD020 - No space inside hashes on closed atx style heading
627
-
628
- Tags: headings, headers, atx_closed, spaces
629
-
630
- Aliases: no-missing-space-closed-atx
631
-
632
- This rule is triggered when spaces are missing inside the hash characters
633
- in a closed atx style heading:
634
-
635
- ```markdown
636
- #Heading 1#
637
-
638
- ##Heading 2##
639
- ```
640
-
641
- To fix this, separate the heading text from the hash character by a single
642
- space:
643
-
644
- ```markdown
645
- # Heading 1 #
646
-
647
- ## Heading 2 ##
648
- ```
649
-
650
- Note: this rule will fire if either side of the heading is missing spaces.
651
-
652
- Rationale: Violations of this rule can lead to improperly rendered content.
653
-
654
- <a name="md021"></a>
655
-
656
- ## MD021 - Multiple spaces inside hashes on closed atx style heading
657
-
658
- Tags: headings, headers, atx_closed, spaces
659
-
660
- Aliases: no-multiple-space-closed-atx
661
-
662
- This rule is triggered when more than one space is used to separate the
663
- heading text from the hash characters in a closed atx style heading:
664
-
665
- ```markdown
666
- # Heading 1 #
667
-
668
- ## Heading 2 ##
669
- ```
670
-
671
- To fix this, separate the heading text from the hash character by a single
672
- space:
673
-
674
- ```markdown
675
- # Heading 1 #
676
-
677
- ## Heading 2 ##
678
- ```
679
-
680
- Note: this rule will fire if either side of the heading contains multiple
681
- spaces.
682
-
683
- Rationale: Extra space has no purpose and does not affect the rendering of
684
- content.
685
-
686
- <a name="md022"></a>
687
-
688
- ## MD022 - Headings should be surrounded by blank lines
689
-
690
- Tags: headings, headers, blank_lines
691
-
692
- Aliases: blanks-around-headings, blanks-around-headers
693
-
694
- Parameters: lines_above, lines_below (number; default 1)
695
-
696
- This rule is triggered when headings (any style) are either not preceded or not
697
- followed by at least one blank line:
698
-
699
- ```markdown
700
- # Heading 1
701
- Some text
702
-
703
- Some more text
704
- ## Heading 2
705
- ```
706
-
707
- To fix this, ensure that all headings have a blank line both before and after
708
- (except where the heading is at the beginning or end of the document):
709
-
710
- ```markdown
711
- # Heading 1
712
-
713
- Some text
714
-
715
- Some more text
716
-
717
- ## Heading 2
718
- ```
719
-
720
- The `lines_above` and `lines_below` parameters can be used to specify a different
721
- number of blank lines (including 0) above or below each heading.
722
-
723
- Note: If `lines_above` or `lines_below` are configured to require more than one
724
- blank line, [MD012/no-multiple-blanks](#md012) should also be customized.
725
-
726
- Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
727
- not parse headings that don't have a blank line before, and will parse them as
728
- regular text.
729
-
730
- <a name="md023"></a>
731
-
732
- ## MD023 - Headings must start at the beginning of the line
733
-
734
- Tags: headings, headers, spaces
735
-
736
- Aliases: heading-start-left, header-start-left
737
-
738
- This rule is triggered when a heading is indented by one or more spaces:
739
-
740
- ```markdown
741
- Some text
742
-
743
- # Indented heading
744
- ```
745
-
746
- To fix this, ensure that all headings start at the beginning of the line:
747
-
748
- ```markdown
749
- Some text
750
-
751
- # Heading
752
- ```
753
-
754
- Rationale: Headings that don't start at the beginning of the line will not be
755
- parsed as headings, and will instead appear as regular text.
756
-
757
- <a name="md024"></a>
758
-
759
- ## MD024 - Multiple headings with the same content
760
-
761
- Tags: headings, headers
762
-
763
- Aliases: no-duplicate-heading, no-duplicate-header
764
-
765
- Parameters: siblings_only, allow_different_nesting (boolean; default `false`)
766
-
767
- This rule is triggered if there are multiple headings in the document that have
768
- the same text:
769
-
770
- ```markdown
771
- # Some text
772
-
773
- ## Some text
774
- ```
775
-
776
- To fix this, ensure that the content of each heading is different:
777
-
778
- ```markdown
779
- # Some text
780
-
781
- ## Some more text
782
- ```
783
-
784
- If the parameter `siblings_only` (alternatively `allow_different_nesting`) is
785
- set to `true`, heading duplication is allowed for non-sibling headings (common
786
- in change logs):
787
-
788
- ```markdown
789
- # Change log
790
-
791
- ## 1.0.0
792
-
793
- ### Features
794
-
795
- ## 2.0.0
796
-
797
- ### Features
798
- ```
799
-
800
- Rationale: Some markdown parsers generate anchors for headings based on the
801
- heading name; headings with the same content can cause problems with that.
802
-
803
- <a name="md025"></a>
804
-
805
- ## MD025 - Multiple top level headings in the same document
806
-
807
- Tags: headings, headers
808
-
809
- Aliases: single-title, single-h1
810
-
811
- Parameters: level, front_matter_title (number; default 1, string; default "^\s*title:")
812
-
813
- This rule is triggered when a top level heading is in use (the first line of
814
- the file is an h1 heading), and more than one h1 heading is in use in the
815
- document:
816
-
817
- ```markdown
818
- # Top level heading
819
-
820
- # Another top level heading
821
- ```
822
-
823
- To fix, structure your document so that there is a single h1 heading that is
824
- the title for the document, and all later headings are h2 or lower level
825
- headings:
826
-
827
- ```markdown
828
- # Title
829
-
830
- ## Heading
831
-
832
- ## Another heading
833
- ```
834
-
835
- Note: The `level` parameter can be used to change the top level (ex: to h2) in
836
- cases where an h1 is added externally.
837
-
838
- If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and contains
839
- a `title` property (commonly used with blog posts), this rule treats that as a top
840
- level heading and will report a violation for any subsequent top level headings.
841
- To use a different property name in front matter, specify the text of a regular
842
- expression via the `front_matter_title` parameter. To disable the use of front
843
- matter by this rule, specify `""` for `front_matter_title`.
844
-
845
- Rationale: A top level heading is an h1 on the first line of the file, and
846
- serves as the title for the document. If this convention is in use, then there
847
- can not be more than one title for the document, and the entire document
848
- should be contained within this heading.
849
-
850
- <a name="md026"></a>
851
-
852
- ## MD026 - Trailing punctuation in heading
853
-
854
- Tags: headings, headers
855
-
856
- Aliases: no-trailing-punctuation
857
-
858
- Parameters: punctuation (string; default ".,;:!?。,;:!?")
859
-
860
- This rule is triggered on any heading that has one of the specified normal or
861
- full-width punctuation characters as the last character in the line:
862
-
863
- ```markdown
864
- # This is a heading.
865
- ```
866
-
867
- To fix this, remove the trailing punctuation:
868
-
869
- ```markdown
870
- # This is a heading
871
- ```
872
-
873
- Note: The `punctuation` parameter can be used to specify what characters count
874
- as punctuation at the end of a heading. For example, you can change it to
875
- `".,;:!"` to allow headings that end with a question mark, such as in an FAQ.
876
- Setting the `punctuation` parameter to `""` allows all characters - and is
877
- equivalent to disabling the rule.
878
-
879
- Rationale: Headings are not meant to be full sentences. More information:
880
- <https://cirosantilli.com/markdown-style-guide#punctuation-at-the-end-of-headers>
881
-
882
- <a name="md027"></a>
883
-
884
- ## MD027 - Multiple spaces after blockquote symbol
885
-
886
- Tags: blockquote, whitespace, indentation
887
-
888
- Aliases: no-multiple-space-blockquote
889
-
890
- This rule is triggered when blockquotes have more than one space after the
891
- blockquote (`>`) symbol:
892
-
893
- ```markdown
894
- > This is a block quote with bad indentation
895
- > there should only be one.
896
- ```
897
-
898
- To fix, remove any extraneous space:
899
-
900
- ```markdown
901
- > This is a blockquote with correct
902
- > indentation.
903
- ```
904
-
905
- Rationale: Consistent formatting makes it easier to understand a document.
906
-
907
- <a name="md028"></a>
908
-
909
- ## MD028 - Blank line inside blockquote
910
-
911
- Tags: blockquote, whitespace
912
-
913
- Aliases: no-blanks-blockquote
914
-
915
- This rule is triggered when two blockquote blocks are separated by nothing
916
- except for a blank line:
917
-
918
- ```markdown
919
- > This is a blockquote
920
- > which is immediately followed by
921
-
922
- > this blockquote. Unfortunately
923
- > In some parsers, these are treated as the same blockquote.
924
- ```
925
-
926
- To fix this, ensure that any blockquotes that are right next to each other
927
- have some text in between:
928
-
929
- ```markdown
930
- > This is a blockquote.
931
-
932
- And Jimmy also said:
933
-
934
- > This too is a blockquote.
935
- ```
936
-
937
- Alternatively, if they are supposed to be the same quote, then add the
938
- blockquote symbol at the beginning of the blank line:
939
-
940
- ```markdown
941
- > This is a blockquote.
942
- >
943
- > This is the same blockquote.
944
- ```
945
-
946
- Rationale: Some markdown parsers will treat two blockquotes separated by one
947
- or more blank lines as the same blockquote, while others will treat them as
948
- separate blockquotes.
949
-
950
- <a name="md029"></a>
951
-
952
- ## MD029 - Ordered list item prefix
953
-
954
- Tags: ol
955
-
956
- Aliases: ol-prefix
957
-
958
- Parameters: style ("one", "ordered", "one_or_ordered", "zero"; default "one_or_ordered")
959
-
960
- This rule is triggered for ordered lists that do not either start with '1.' or
961
- do not have a prefix that increases in numerical order (depending on the
962
- configured style). The less-common patterns of using '0.' as a first prefix or
963
- for all prefixes is also supported.
964
-
965
- Example valid list if the style is configured as 'one':
966
-
967
- ```markdown
968
- 1. Do this.
969
- 1. Do that.
970
- 1. Done.
971
- ```
972
-
973
- Examples of valid lists if the style is configured as 'ordered':
974
-
975
- ```markdown
976
- 1. Do this.
977
- 2. Do that.
978
- 3. Done.
979
- ```
980
-
981
- ```markdown
982
- 0. Do this.
983
- 1. Do that.
984
- 2. Done.
985
- ```
986
-
987
- All three examples are valid when the style is configured as 'one_or_ordered'.
988
-
989
- Example valid list if the style is configured as 'zero':
990
-
991
- ```markdown
992
- 0. Do this.
993
- 0. Do that.
994
- 0. Done.
995
- ```
996
-
997
- Example invalid list for all styles:
998
-
999
- ```markdown
1000
- 1. Do this.
1001
- 3. Done.
1002
- ```
1003
-
1004
- This rule supports 0-prefixing ordered list items for uniform indentation:
1005
-
1006
- ```markdown
1007
- ...
1008
- 08. Item
1009
- 09. Item
1010
- 10. Item
1011
- 11. Item
1012
- ...
1013
- ```
1014
-
1015
- Note: This rule will report violations for cases like the following where an improperly-indented code block (or similar) appears between two list items and "breaks" the list in two:
1016
-
1017
- ~~~markdown
1018
- 1. First list
1019
-
1020
- ```text
1021
- Code block
1022
- ```
1023
-
1024
- 1. Second list
1025
- ~~~
1026
-
1027
- The fix is to indent the code block so it becomes part of the preceding list item as intended:
1028
-
1029
- ~~~markdown
1030
- 1. First list
1031
-
1032
- ```text
1033
- Code block
1034
- ```
1035
-
1036
- 2. Still first list
1037
- ~~~
1038
-
1039
- Rationale: Consistent formatting makes it easier to understand a document.
1040
-
1041
- <a name="md030"></a>
1042
-
1043
- ## MD030 - Spaces after list markers
1044
-
1045
- Tags: ol, ul, whitespace
1046
-
1047
- Aliases: list-marker-space
1048
-
1049
- Parameters: ul_single, ol_single, ul_multi, ol_multi (number; default 1)
1050
-
1051
- This rule checks for the number of spaces between a list marker (e.g. '`-`',
1052
- '`*`', '`+`' or '`1.`') and the text of the list item.
1053
-
1054
- The number of spaces checked for depends on the document style in use, but the
1055
- default is 1 space after any list marker:
1056
-
1057
- ```markdown
1058
- * Foo
1059
- * Bar
1060
- * Baz
1061
-
1062
- 1. Foo
1063
- 1. Bar
1064
- 1. Baz
1065
-
1066
- 1. Foo
1067
- * Bar
1068
- 1. Baz
1069
- ```
1070
-
1071
- A document style may change the number of spaces after unordered list items
1072
- and ordered list items independently, as well as based on whether the content
1073
- of every item in the list consists of a single paragraph, or multiple
1074
- paragraphs (including sub-lists and code blocks).
1075
-
1076
- For example, the style guide at
1077
- <https://cirosantilli.com/markdown-style-guide#spaces-after-list-marker>
1078
- specifies that 1 space after the list marker should be used if every item in
1079
- the list fits within a single paragraph, but to use 2 or 3 spaces (for ordered
1080
- and unordered lists respectively) if there are multiple paragraphs of content
1081
- inside the list:
1082
-
1083
- ```markdown
1084
- * Foo
1085
- * Bar
1086
- * Baz
1087
- ```
1088
-
1089
- vs.
1090
-
1091
- ```markdown
1092
- * Foo
1093
-
1094
- Second paragraph
1095
-
1096
- * Bar
1097
- ```
1098
-
1099
- or
1100
-
1101
- ```markdown
1102
- 1. Foo
1103
-
1104
- Second paragraph
1105
-
1106
- 1. Bar
1107
- ```
1108
-
1109
- To fix this, ensure the correct number of spaces are used after list marker
1110
- for your selected document style.
1111
-
1112
- Rationale: Violations of this rule can lead to improperly rendered content.
1113
-
1114
- <a name="md031"></a>
1115
-
1116
- ## MD031 - Fenced code blocks should be surrounded by blank lines
1117
-
1118
- Tags: code, blank_lines
1119
-
1120
- Aliases: blanks-around-fences
1121
-
1122
- Parameters: list_items (boolean; default true)
1123
-
1124
- This rule is triggered when fenced code blocks are either not preceded or not
1125
- followed by a blank line:
1126
-
1127
- ````markdown
1128
- Some text
1129
- ```
1130
- Code block
1131
- ```
1132
-
1133
- ```
1134
- Another code block
1135
- ```
1136
- Some more text
1137
- ````
1138
-
1139
- To fix this, ensure that all fenced code blocks have a blank line both before
1140
- and after (except where the block is at the beginning or end of the document):
1141
-
1142
- ````markdown
1143
- Some text
1144
-
1145
- ```
1146
- Code block
1147
- ```
1148
-
1149
- ```
1150
- Another code block
1151
- ```
1152
-
1153
- Some more text
1154
- ````
1155
-
1156
- Set the `list_items` parameter to `false` to disable this rule for list items.
1157
- Disabling this behavior for lists can be useful if it is necessary to create a
1158
- [tight](https://spec.commonmark.org/0.29/#tight) list containing a code fence.
1159
-
1160
- Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
1161
- not parse fenced code blocks that don't have blank lines before and after them.
1162
-
1163
- <a name="md032"></a>
1164
-
1165
- ## MD032 - Lists should be surrounded by blank lines
1166
-
1167
- Tags: bullet, ul, ol, blank_lines
1168
-
1169
- Aliases: blanks-around-lists
1170
-
1171
- This rule is triggered when lists (of any kind) are either not preceded or not
1172
- followed by a blank line:
1173
-
1174
- ```markdown
1175
- Some text
1176
- * Some
1177
- * List
1178
-
1179
- 1. Some
1180
- 2. List
1181
- Some text
1182
- ```
1183
-
1184
- To fix this, ensure that all lists have a blank line both before and after
1185
- (except where the block is at the beginning or end of the document):
1186
-
1187
- ```markdown
1188
- Some text
1189
-
1190
- * Some
1191
- * List
1192
-
1193
- 1. Some
1194
- 2. List
1195
-
1196
- Some text
1197
- ```
1198
-
1199
- Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
1200
- not parse lists that don't have blank lines before and after them.
1201
-
1202
- <a name="md033"></a>
1203
-
1204
- ## MD033 - Inline HTML
1205
-
1206
- Tags: html
1207
-
1208
- Aliases: no-inline-html
1209
-
1210
- Parameters: allowed_elements (array of string; default empty)
1211
-
1212
- This rule is triggered whenever raw HTML is used in a markdown document:
1213
-
1214
- ```markdown
1215
- <h1>Inline HTML heading</h1>
1216
- ```
1217
-
1218
- To fix this, use 'pure' markdown instead of including raw HTML:
1219
-
1220
- ```markdown
1221
- # Markdown heading
1222
- ```
1223
-
1224
- Note: To allow specific HTML elements, use the 'allowed_elements' parameter.
1225
-
1226
- Rationale: Raw HTML is allowed in markdown, but this rule is included for
1227
- those who want their documents to only include "pure" markdown, or for those
1228
- who are rendering markdown documents in something other than HTML.
1229
-
1230
- <a name="md034"></a>
1231
-
1232
- ## MD034 - Bare URL used
1233
-
1234
- Tags: links, url
1235
-
1236
- Aliases: no-bare-urls
1237
-
1238
- This rule is triggered whenever a URL is given that isn't surrounded by angle
1239
- brackets:
1240
-
1241
- ```markdown
1242
- For more information, see https://www.example.com/.
1243
- ```
1244
-
1245
- To fix this, add angle brackets around the URL:
1246
-
1247
- ```markdown
1248
- For more information, see <https://www.example.com/>.
1249
- ```
1250
-
1251
- Note: To use a bare URL without it being converted into a link, enclose it in
1252
- a code block, otherwise in some markdown parsers it _will_ be converted:
1253
-
1254
- ```markdown
1255
- `https://www.example.com`
1256
- ```
1257
-
1258
- Note: The following scenario does _not_ trigger this rule to avoid conflicts
1259
- with `MD011`/`no-reversed-links`:
1260
-
1261
- ```markdown
1262
- [https://www.example.com]
1263
- ```
1264
-
1265
- The use of quotes around a bare link will _not_ trigger this rule, either:
1266
-
1267
- ```markdown
1268
- "https://www.example.com"
1269
- 'https://www.example.com'
1270
- ```
1271
-
1272
- Rationale: Without angle brackets, the URL isn't converted into a link by many
1273
- markdown parsers.
1274
-
1275
- <a name="md035"></a>
1276
-
1277
- ## MD035 - Horizontal rule style
1278
-
1279
- Tags: hr
1280
-
1281
- Aliases: hr-style
1282
-
1283
- Parameters: style ("consistent", "---", "***", or other string specifying the
1284
- horizontal rule; default "consistent")
1285
-
1286
- This rule is triggered when inconsistent styles of horizontal rules are used
1287
- in the document:
1288
-
1289
- ```markdown
1290
- ---
1291
-
1292
- - - -
1293
-
1294
- ***
1295
-
1296
- * * *
1297
-
1298
- ****
1299
- ```
1300
-
1301
- To fix this, ensure any horizontal rules used in the document are consistent,
1302
- or match the given style if the rule is so configured:
1303
-
1304
- ```markdown
1305
- ---
1306
-
1307
- ---
1308
- ```
1309
-
1310
- Note: by default, this rule is configured to just require that all horizontal
1311
- rules in the document are the same, and will trigger if any of the horizontal
1312
- rules are different than the first one encountered in the document. If you
1313
- want to configure the rule to match a specific style, the parameter given to
1314
- the 'style' option is a string containing the exact horizontal rule text that
1315
- is allowed.
1316
-
1317
- Rationale: Consistent formatting makes it easier to understand a document.
1318
-
1319
- <a name="md036"></a>
1320
-
1321
- ## MD036 - Emphasis used instead of a heading
1322
-
1323
- Tags: headings, headers, emphasis
1324
-
1325
- Aliases: no-emphasis-as-heading, no-emphasis-as-header
1326
-
1327
- Parameters: punctuation (string; default ".,;:!?。,;:!?")
1328
-
1329
- This check looks for instances where emphasized (i.e. bold or italic) text is
1330
- used to separate sections, where a heading should be used instead:
1331
-
1332
- ```markdown
1333
- **My document**
1334
-
1335
- Lorem ipsum dolor sit amet...
1336
-
1337
- _Another section_
1338
-
1339
- Consectetur adipiscing elit, sed do eiusmod.
1340
- ```
1341
-
1342
- To fix this, use markdown headings instead of emphasized text to denote
1343
- sections:
1344
-
1345
- ```markdown
1346
- # My document
1347
-
1348
- Lorem ipsum dolor sit amet...
1349
-
1350
- ## Another section
1351
-
1352
- Consectetur adipiscing elit, sed do eiusmod.
1353
- ```
1354
-
1355
- Note: This rule looks for single line paragraphs that consist entirely
1356
- of emphasized text. It won't fire on emphasis used within regular text,
1357
- multi-line emphasized paragraphs, or paragraphs ending in punctuation
1358
- (normal or full-width). Similarly to rule MD026, you can configure what
1359
- characters are recognized as punctuation.
1360
-
1361
- Rationale: Using emphasis instead of a heading prevents tools from inferring
1362
- the structure of a document. More information:
1363
- <https://cirosantilli.com/markdown-style-guide#emphasis-vs-headers>.
1364
-
1365
- <a name="md037"></a>
1366
-
1367
- ## MD037 - Spaces inside emphasis markers
1368
-
1369
- Tags: whitespace, emphasis
1370
-
1371
- Aliases: no-space-in-emphasis
1372
-
1373
- This rule is triggered when emphasis markers (bold, italic) are used, but they
1374
- have spaces between the markers and the text:
1375
-
1376
- ```markdown
1377
- Here is some ** bold ** text.
1378
-
1379
- Here is some * italic * text.
1380
-
1381
- Here is some more __ bold __ text.
1382
-
1383
- Here is some more _ italic _ text.
1384
- ```
1385
-
1386
- To fix this, remove the spaces around the emphasis markers:
1387
-
1388
- ```markdown
1389
- Here is some **bold** text.
1390
-
1391
- Here is some *italic* text.
1392
-
1393
- Here is some more __bold__ text.
1394
-
1395
- Here is some more _italic_ text.
1396
- ```
1397
-
1398
- Rationale: Emphasis is only parsed as such when the asterisks/underscores
1399
- aren't completely surrounded by spaces. This rule attempts to detect where
1400
- they were surrounded by spaces, but it appears that emphasized text was
1401
- intended by the author.
1402
-
1403
- <a name="md038"></a>
1404
-
1405
- ## MD038 - Spaces inside code span elements
1406
-
1407
- Tags: whitespace, code
1408
-
1409
- Aliases: no-space-in-code
1410
-
1411
- This rule is triggered for code span elements that have spaces adjacent to the
1412
- backticks:
1413
-
1414
- ```markdown
1415
- `some text `
1416
-
1417
- ` some text`
1418
- ```
1419
-
1420
- To fix this, remove any spaces adjacent to the backticks:
1421
-
1422
- ```markdown
1423
- `some text`
1424
- ```
1425
-
1426
- Note: A single leading and trailing space is allowed by the specification and
1427
- automatically trimmed (to allow for embedded backticks):
1428
-
1429
- ```markdown
1430
- `` `backticks` ``
1431
- ```
1432
-
1433
- Note: A single leading or trailing space is allowed if used to separate codespan
1434
- markers from an embedded backtick:
1435
-
1436
- ```markdown
1437
- `` ` embedded backtick``
1438
- ```
1439
-
1440
- Rationale: Violations of this rule can lead to improperly rendered content.
1441
-
1442
- <a name="md039"></a>
1443
-
1444
- ## MD039 - Spaces inside link text
1445
-
1446
- Tags: whitespace, links
1447
-
1448
- Aliases: no-space-in-links
1449
-
1450
- This rule is triggered on links that have spaces surrounding the link text:
1451
-
1452
- ```markdown
1453
- [ a link ](https://www.example.com/)
1454
- ```
1455
-
1456
- To fix this, remove the spaces surrounding the link text:
1457
-
1458
- ```markdown
1459
- [a link](https://www.example.com/)
1460
- ```
1461
-
1462
- Rationale: Consistent formatting makes it easier to understand a document.
1463
-
1464
- <a name="md040"></a>
1465
-
1466
- ## MD040 - Fenced code blocks should have a language specified
1467
-
1468
- Tags: code, language
1469
-
1470
- Aliases: fenced-code-language
1471
-
1472
- This rule is triggered when fenced code blocks are used, but a language isn't
1473
- specified:
1474
-
1475
- ````markdown
1476
- ```
1477
- #!/bin/bash
1478
- echo Hello world
1479
- ```
1480
- ````
1481
-
1482
- To fix this, add a language specifier to the code block:
1483
-
1484
- ````markdown
1485
- ```bash
1486
- #!/bin/bash
1487
- echo Hello world
1488
- ```
1489
- ````
1490
-
1491
- Rationale: Specifying a language improves content rendering by using the
1492
- correct syntax highlighting for code. More information:
1493
- <https://cirosantilli.com/markdown-style-guide#option-code-fenced>.
1494
-
1495
- <a name="md041"></a>
1496
-
1497
- ## MD041 - First line in file should be a top level heading
1498
-
1499
- Tags: headings, headers
1500
-
1501
- Aliases: first-line-heading, first-line-h1
1502
-
1503
- Parameters: level, front_matter_title (number; default 1, string; default "^\s*title:")
1504
-
1505
- This rule is intended to ensure documents have a title and is triggered when
1506
- the first line in the file isn't a top level (h1) heading:
1507
-
1508
- ```markdown
1509
- This is a file without a heading
1510
- ```
1511
-
1512
- To fix this, add a top level heading to the beginning of the file:
1513
-
1514
- ```markdown
1515
- # File with heading
1516
-
1517
- This is a file with a top level heading
1518
- ```
1519
-
1520
- Note: The `level` parameter can be used to change the top level (ex: to h2) in cases
1521
- where an h1 is added externally.
1522
-
1523
- If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and contains a
1524
- `title` property (commonly used with blog posts), this rule will not report a
1525
- violation. To use a different property name in front matter, specify the text
1526
- of a regular expression via the `front_matter_title` parameter. To disable the
1527
- use of front matter by this rule, specify `""` for `front_matter_title`.
1528
-
1529
- Rationale: The top level heading often acts as the title of a document. More
1530
- information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
1531
-
1532
- <a name="md042"></a>
1533
-
1534
- ## MD042 - No empty links
1535
-
1536
- Tags: links
1537
-
1538
- Aliases: no-empty-links
1539
-
1540
- This rule is triggered when an empty link is encountered:
1541
-
1542
- ```markdown
1543
- [an empty link]()
1544
- ```
1545
-
1546
- To fix the violation, provide a destination for the link:
1547
-
1548
- ```markdown
1549
- [a valid link](https://example.com/)
1550
- ```
1551
-
1552
- Empty fragments will trigger this rule:
1553
-
1554
- ```markdown
1555
- [an empty fragment](#)
1556
- ```
1557
-
1558
- But non-empty fragments will not:
1559
-
1560
- ```markdown
1561
- [a valid fragment](#fragment)
1562
- ```
1563
-
1564
- Rationale: Empty links do not lead anywhere and therefore don't function as links.
1565
-
1566
- <a name="md043"></a>
1567
-
1568
- ## MD043 - Required heading structure
1569
-
1570
- Tags: headings, headers
1571
-
1572
- Aliases: required-headings, required-headers
1573
-
1574
- Parameters: headings, headers (array of string; default `null` for disabled)
1575
-
1576
- > If `headings` is not provided, `headers` (deprecated) will be used.
1577
-
1578
- This rule is triggered when the headings in a file do not match the array of
1579
- headings passed to the rule. It can be used to enforce a standard heading
1580
- structure for a set of files.
1581
-
1582
- To require exactly the following structure:
1583
-
1584
- ```markdown
1585
- # Head
1586
- ## Item
1587
- ### Detail
1588
- ```
1589
-
1590
- Set the `headings` parameter to:
1591
-
1592
- ```json
1593
- [
1594
- "# Head",
1595
- "## Item",
1596
- "### Detail"
1597
- ]
1598
- ```
1599
-
1600
- To allow optional headings as with the following structure:
1601
-
1602
- ```markdown
1603
- # Head
1604
- ## Item
1605
- ### Detail (optional)
1606
- ## Foot
1607
- ### Notes (optional)
1608
- ```
1609
-
1610
- Use the special value `"*"` meaning "one or more unspecified headings" and set
1611
- the `headings` parameter to:
1612
-
1613
- ```json
1614
- [
1615
- "# Head",
1616
- "## Item",
1617
- "*",
1618
- "## Foot",
1619
- "*"
1620
- ]
1621
- ```
1622
-
1623
- When an error is detected, this rule outputs the line number of the first
1624
- problematic heading (otherwise, it outputs the last line number of the file).
1625
-
1626
- Note that while the `headings` parameter uses the "## Text" ATX heading style for
1627
- simplicity, a file may use any supported heading style.
1628
-
1629
- Rationale: Projects may wish to enforce a consistent document structure across
1630
- a set of similar content.
1631
-
1632
- <a name="md044"></a>
1633
-
1634
- ## MD044 - Proper names should have the correct capitalization
1635
-
1636
- Tags: spelling
1637
-
1638
- Aliases: proper-names
1639
-
1640
- Parameters: names, code_blocks (string array; default `null`, boolean; default `true`)
1641
-
1642
- This rule is triggered when any of the strings in the `names` array do not have
1643
- the specified capitalization. It can be used to enforce a standard letter case
1644
- for the names of projects and products.
1645
-
1646
- For example, the language "JavaScript" is usually written with both the 'J' and
1647
- 'S' capitalized - though sometimes the 's' or 'j' appear in lower-case. To enforce
1648
- the proper capitalization, specify the desired letter case in the `names` array:
1649
-
1650
- ```json
1651
- [
1652
- "JavaScript"
1653
- ]
1654
- ```
1655
-
1656
- Set the `code_blocks` parameter to `false` to disable this rule for code blocks.
1657
-
1658
- Rationale: Incorrect capitalization of proper names is usually a mistake.
1659
-
1660
- <a name="md045"></a>
1661
-
1662
- ## MD045 - Images should have alternate text (alt text)
1663
-
1664
- Tags: accessibility, images
1665
-
1666
- Aliases: no-alt-text
1667
-
1668
- This rule is triggered when an image is missing alternate text (alt text) information.
1669
-
1670
- Alternate text is commonly specified inline as:
1671
-
1672
- ```markdown
1673
- ![Alternate text](image.jpg)
1674
- ```
1675
-
1676
- Or with reference syntax as:
1677
-
1678
- ```markdown
1679
- ![Alternate text][ref]
1680
-
1681
- ...
1682
-
1683
- [ref]: image.jpg "Optional title"
1684
- ```
1685
-
1686
- Guidance for writing alternate text is available from the [W3C](https://www.w3.org/WAI/alt/),
1687
- [Wikipedia](https://en.wikipedia.org/wiki/Alt_attribute), and
1688
- [other locations](https://www.phase2technology.com/blog/no-more-excuses-definitive-guide-alt-text-field).
1689
-
1690
- Rationale: Alternate text is important for accessibility and describes the
1691
- content of an image for people who may not be able to see it.
1692
-
1693
- <a name="md046"></a>
1694
-
1695
- ## MD046 - Code block style
1696
-
1697
- Tags: code
1698
-
1699
- Aliases: code-block-style
1700
-
1701
- Parameters: style ("consistent", "fenced", "indented"; default "consistent")
1702
-
1703
- This rule is triggered when unwanted or different code block styles are used in
1704
- the same document.
1705
-
1706
- In the default configuration this rule reports a violation for the following document:
1707
-
1708
- Some text.
1709
-
1710
- # Indented code
1711
-
1712
- More text.
1713
-
1714
- ```ruby
1715
- # Fenced code
1716
- ```
1717
-
1718
- More text.
1719
-
1720
- To fix violations of this rule, use a consistent style (either indenting or code fences).
1721
-
1722
- The specified style can be specific (`fenced`, `indented`) or simply require that usage
1723
- be consistent within the document (`consistent`).
1724
-
1725
- Rationale: Consistent formatting makes it easier to understand a document.
1726
-
1727
- <a name="md047"></a>
1728
-
1729
- ## MD047 - Files should end with a single newline character
1730
-
1731
- Tags: blank_lines
1732
-
1733
- Aliases: single-trailing-newline
1734
-
1735
- This rule is triggered when there is not a single newline character at the end of a file.
1736
-
1737
- Example that triggers the rule:
1738
-
1739
- ```markdown
1740
- # Heading
1741
-
1742
- This file ends without a newline.[EOF]
1743
- ```
1744
-
1745
- To fix the violation, add a newline character to the end of the file:
1746
-
1747
- ```markdown
1748
- # Heading
1749
-
1750
- This file ends with a newline.
1751
- [EOF]
1752
- ```
1753
-
1754
- Rationale: Some programs have trouble with files that do not end with a newline.
1755
- More information: <https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file>.
1756
-
1757
- <a name="md048"></a>
1758
-
1759
- ## MD048 - Code fence style
1760
-
1761
- Tags: code
1762
-
1763
- Aliases: code-fence-style
1764
-
1765
- Parameters: style ("consistent", "tilde", "backtick"; default "consistent")
1766
-
1767
- This rule is triggered when the symbols used in the document for fenced code blocks do not match the configured code fence style:
1768
-
1769
- ````markdown
1770
- ```ruby
1771
- # Fenced code
1772
- ```
1773
-
1774
- ~~~ruby
1775
- # Fenced code
1776
- ~~~
1777
- ````
1778
-
1779
- To fix this issue, use the configured code fence style throughout the
1780
- document:
1781
-
1782
- ````markdown
1783
- ```ruby
1784
- # Fenced code
1785
- ```
1786
-
1787
- ```ruby
1788
- # Fenced code
1789
- ```
1790
- ````
1791
-
1792
- The configured list style can be a specific symbol to use (backtick, tilde), or
1793
- can require that usage be consistent within the document.
1794
-
1795
- Rationale: Consistent formatting makes it easier to understand a document.
1
+ # Rules
2
+
3
+ This document contains a description of all rules, what they are checking for,
4
+ as well as an examples of documents that break the rule and corrected
5
+ versions of the examples. Any rule whose heading is ~~struck through~~ is
6
+ deprecated, but still provided for backward-compatibility.
7
+
8
+ <a name="md001"></a>
9
+
10
+ ## MD001 - Heading levels should only increment by one level at a time
11
+
12
+ Tags: headings, headers
13
+
14
+ Aliases: heading-increment, header-increment
15
+
16
+ This rule is triggered when you skip heading levels in a markdown document, for
17
+ example:
18
+
19
+ ```markdown
20
+ # Heading 1
21
+
22
+ ### Heading 3
23
+
24
+ We skipped out a 2nd level heading in this document
25
+ ```
26
+
27
+ When using multiple heading levels, nested headings should increase by only one
28
+ level at a time:
29
+
30
+ ```markdown
31
+ # Heading 1
32
+
33
+ ## Heading 2
34
+
35
+ ### Heading 3
36
+
37
+ #### Heading 4
38
+
39
+ ## Another Heading 2
40
+
41
+ ### Another Heading 3
42
+ ```
43
+
44
+ Rationale: Headings represent the structure of a document and can be confusing
45
+ when skipped - especially for accessibility scenarios. More information:
46
+ <https://www.w3.org/WAI/tutorials/page-structure/headings/>.
47
+
48
+ <a name="md002"></a>
49
+
50
+ ## ~~MD002 - First heading should be a top level heading~~
51
+
52
+ Tags: headings, headers
53
+
54
+ Aliases: first-heading-h1, first-header-h1
55
+
56
+ Parameters: level (number; default 1)
57
+
58
+ > Note: *MD002 has been deprecated and is disabled by default.*
59
+ > [MD041/first-line-heading](#md041) offers an improved implementation.
60
+
61
+ This rule is intended to ensure document headings start at the top level and
62
+ is triggered when the first heading in the document isn't a h1 heading:
63
+
64
+ ```markdown
65
+ ## This isn't a H1 heading
66
+
67
+ ### Another heading
68
+ ```
69
+
70
+ The first heading in the document should be a h1 heading:
71
+
72
+ ```markdown
73
+ # Start with a H1 heading
74
+
75
+ ## Then use an H2 for subsections
76
+ ```
77
+
78
+ Note: The `level` parameter can be used to change the top level (ex: to h2) in
79
+ cases where a h1 is added externally.
80
+
81
+ Rationale: The top level heading often acts as the title of a document. More
82
+ information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
83
+
84
+ <a name="md003"></a>
85
+
86
+ ## MD003 - Heading style
87
+
88
+ Tags: headings, headers
89
+
90
+ Aliases: heading-style, header-style
91
+
92
+ Parameters: style ("consistent", "atx", "atx_closed", "setext",
93
+ "setext_with_atx", "setext_with_atx_closed"; default "consistent")
94
+
95
+ This rule is triggered when different heading styles (atx, setext, and 'closed'
96
+ atx) are used in the same document:
97
+
98
+ ```markdown
99
+ # ATX style H1
100
+
101
+ ## Closed ATX style H2 ##
102
+
103
+ Setext style H1
104
+ ===============
105
+ ```
106
+
107
+ Be consistent with the style of heading used in a document:
108
+
109
+ ```markdown
110
+ # ATX style H1
111
+
112
+ ## ATX style H2
113
+ ```
114
+
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:
117
+
118
+ ```markdown
119
+ Setext style H1
120
+ ===============
121
+
122
+ Setext style H2
123
+ ---------------
124
+
125
+ ### ATX style H3
126
+ ```
127
+
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 be consistent within the document.
131
+
132
+ Rationale: Consistent formatting makes it easier to understand a document.
133
+
134
+ <a name="md004"></a>
135
+
136
+ ## MD004 - Unordered list style
137
+
138
+ Tags: bullet, ul
139
+
140
+ Aliases: ul-style
141
+
142
+ Parameters: style ("consistent", "asterisk", "plus", "dash", "sublist"; default
143
+ "consistent")
144
+
145
+ This rule is triggered when the symbols used in the document for unordered
146
+ list items do not match the configured unordered list style:
147
+
148
+ ```markdown
149
+ * Item 1
150
+ + Item 2
151
+ - Item 3
152
+ ```
153
+
154
+ To fix this issue, use the configured style for list items throughout the
155
+ document:
156
+
157
+ ```markdown
158
+ * Item 1
159
+ * Item 2
160
+ * Item 3
161
+ ```
162
+
163
+ The configured list style can be a specific symbol to use (asterisk, plus, dash),
164
+ can require that usage be consistent within the document, or can require that each
165
+ sublist have a consistent symbol that is different from its parent list.
166
+
167
+ For example, the following is valid for the `sublist` style because the outer-most
168
+ indent uses asterisk, the middle indent uses plus, and the inner-most indent uses dash:
169
+
170
+ ```markdown
171
+ * Item 1
172
+ + Item 2
173
+ - Item 3
174
+ + Item 4
175
+ * Item 4
176
+ + Item 5
177
+ ```
178
+
179
+ Rationale: Consistent formatting makes it easier to understand a document.
180
+
181
+ <a name="md005"></a>
182
+
183
+ ## MD005 - Inconsistent indentation for list items at the same level
184
+
185
+ Tags: bullet, ul, indentation
186
+
187
+ Aliases: list-indent
188
+
189
+ Fixable: Most violations can be fixed by tooling
190
+
191
+ This rule is triggered when list items are parsed as being at the same level,
192
+ but don't have the same indentation:
193
+
194
+ ```markdown
195
+ * Item 1
196
+ * Nested Item 1
197
+ * Nested Item 2
198
+ * A misaligned item
199
+ ```
200
+
201
+ Usually this rule will be triggered because of a typo. Correct the indentation
202
+ for the list to fix it:
203
+
204
+ ```markdown
205
+ * Item 1
206
+ * Nested Item 1
207
+ * Nested Item 2
208
+ * Nested Item 3
209
+ ```
210
+
211
+ Sequentially-ordered list markers are usually left-aligned such that all items
212
+ have the same starting column:
213
+
214
+ ```markdown
215
+ ...
216
+ 8. Item
217
+ 9. Item
218
+ 10. Item
219
+ 11. Item
220
+ ...
221
+ ```
222
+
223
+ This rule also supports right-alignment of list markers such that all items have
224
+ the same ending column:
225
+
226
+ ```markdown
227
+ ...
228
+ 8. Item
229
+ 9. Item
230
+ 10. Item
231
+ 11. Item
232
+ ...
233
+ ```
234
+
235
+ Rationale: Violations of this rule can lead to improperly rendered content.
236
+
237
+ <a name="md006"></a>
238
+
239
+ ## ~~MD006 - Consider starting bulleted lists at the beginning of the line~~
240
+
241
+ Tags: bullet, ul, indentation
242
+
243
+ Aliases: ul-start-left
244
+
245
+ Fixable: Most violations can be fixed by tooling
246
+
247
+ This rule is triggered when top level lists don't start at the beginning of a
248
+ line:
249
+
250
+ ```markdown
251
+ Some text
252
+
253
+ * List item
254
+ * List item
255
+ ```
256
+
257
+ To fix, ensure that top level list items are not indented:
258
+
259
+ ```markdown
260
+ Some test
261
+
262
+ * List item
263
+ * List item
264
+ ```
265
+
266
+ Note: This rule is triggered for the following scenario because the unordered
267
+ sublist is not recognized as such by the parser. Not being nested 3 characters
268
+ as required by the outer ordered list, it creates a top-level unordered list
269
+ instead.
270
+
271
+ ```markdown
272
+ 1. List item
273
+ - List item
274
+ - List item
275
+ 1. List item
276
+ ```
277
+
278
+ Rationale: Starting lists at the beginning of the line means that nested list
279
+ items can all be indented by the same amount when an editor's indent function
280
+ or the tab key is used to indent. Starting a list 1 space in means that the
281
+ indent of the first nested list is less than the indent of the second level (3
282
+ characters if you use 4 space tabs, or 1 character if you use 2 space tabs).
283
+
284
+ <a name="md007"></a>
285
+
286
+ ## MD007 - Unordered list indentation
287
+
288
+ Tags: bullet, ul, indentation
289
+
290
+ Aliases: ul-indent
291
+
292
+ Parameters: indent, start_indented (number; default 2, boolean; default false)
293
+
294
+ Fixable: Most violations can be fixed by tooling
295
+
296
+ This rule is triggered when list items are not indented by the configured
297
+ number of spaces (default: 2).
298
+
299
+ Example:
300
+
301
+ ```markdown
302
+ * List item
303
+ * Nested list item indented by 3 spaces
304
+ ```
305
+
306
+ Corrected Example:
307
+
308
+ ```markdown
309
+ * List item
310
+ * Nested list item indented by 2 spaces
311
+ ```
312
+
313
+ Note: This rule applies to a sublist only if its parent lists are all also
314
+ unordered (otherwise, extra indentation of ordered lists interferes with the
315
+ rule).
316
+
317
+ The `start_indented` parameter allows the first level of lists to be indented by
318
+ the configured number of spaces rather than starting at zero (the inverse of
319
+ MD006).
320
+
321
+ Rationale: Indenting by 2 spaces allows the content of a nested list to be in
322
+ line with the start of the content of the parent list when a single space is
323
+ used after the list marker. Indenting by 4 spaces is consistent with code blocks
324
+ and simpler for editors to implement. Additionally, this can be a compatibility
325
+ issue for multi-markdown parsers, which require a 4-space indents. More information:
326
+ <https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists>
327
+ and <http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting>.
328
+
329
+ <a name="md009"></a>
330
+
331
+ ## MD009 - Trailing spaces
332
+
333
+ Tags: whitespace
334
+
335
+ Aliases: no-trailing-spaces
336
+
337
+ Parameters: br_spaces, list_item_empty_lines, strict (number; default 2, boolean; default false, boolean; default false)
338
+
339
+ Fixable: Most violations can be fixed by tooling
340
+
341
+ This rule is triggered on any lines that end with unexpected whitespace. To fix this,
342
+ remove the trailing space from the end of the line.
343
+
344
+ The `br_spaces` parameter allows an exception to this rule for a specific number
345
+ of trailing spaces, typically used to insert an explicit line break. The default
346
+ value allows 2 spaces to indicate a hard break (\<br> element).
347
+
348
+ Note: You must set `br_spaces` to a value >= 2 for this parameter to take effect.
349
+ Setting `br_spaces` to 1 behaves the same as 0, disallowing any trailing spaces.
350
+
351
+ By default, this rule will not trigger when the allowed number of spaces is used,
352
+ even when it doesn't create a hard break (for example, at the end of a paragraph).
353
+ To report such instances as well, set the `strict` parameter to `true`.
354
+
355
+ ```markdown
356
+ Text text text
357
+ text[2 spaces]
358
+ ```
359
+
360
+ Using spaces to indent blank lines inside a list item is usually not necessary,
361
+ but some parsers require it. Set the `list_item_empty_lines` parameter to `true`
362
+ to allow this (even when `strict` is `true`):
363
+
364
+ ```markdown
365
+ - list item text
366
+ [2 spaces]
367
+ list item text
368
+ ```
369
+
370
+ Rationale: Except when being used to create a line break, trailing whitespace
371
+ has no purpose and does not affect the rendering of content.
372
+
373
+ <a name="md010"></a>
374
+
375
+ ## MD010 - Hard tabs
376
+
377
+ Tags: whitespace, hard_tab
378
+
379
+ Aliases: no-hard-tabs
380
+
381
+ Parameters: code_blocks (boolean; default true)
382
+
383
+ Fixable: Most violations can be fixed by tooling
384
+
385
+ This rule is triggered by any lines that contain hard tab characters instead
386
+ of using spaces for indentation. To fix this, replace any hard tab characters
387
+ with spaces instead.
388
+
389
+ Example:
390
+
391
+ <!-- markdownlint-disable no-hard-tabs -->
392
+
393
+ ```markdown
394
+ Some text
395
+
396
+ * hard tab character used to indent the list item
397
+ ```
398
+
399
+ <!-- markdownlint-enable no-hard-tabs -->
400
+
401
+ Corrected example:
402
+
403
+ ```markdown
404
+ Some text
405
+
406
+ * Spaces used to indent the list item instead
407
+ ```
408
+
409
+ You have the option to exclude this rule for code blocks. To do so, set the
410
+ `code_blocks` parameter to `false`. Code blocks are included by default since
411
+ handling of tabs by tools is often inconsistent (ex: using 4 vs. 8 spaces).
412
+
413
+ Rationale: Hard tabs are often rendered inconsistently by different editors and
414
+ can be harder to work with than spaces.
415
+
416
+ <a name="md011"></a>
417
+
418
+ ## MD011 - Reversed link syntax
419
+
420
+ Tags: links
421
+
422
+ Aliases: no-reversed-links
423
+
424
+ Fixable: Most violations can be fixed by tooling
425
+
426
+ This rule is triggered when text that appears to be a link is encountered, but
427
+ where the syntax appears to have been reversed (the `[]` and `()` are
428
+ reversed):
429
+
430
+ ```markdown
431
+ (Incorrect link syntax)[https://www.example.com/]
432
+ ```
433
+
434
+ To fix this, swap the `[]` and `()` around:
435
+
436
+ ```markdown
437
+ [Correct link syntax](https://www.example.com/)
438
+ ```
439
+
440
+ Note: [Markdown Extra](https://en.wikipedia.org/wiki/Markdown_Extra)-style footnotes do not trigger this rule:
441
+
442
+ ```markdown
443
+ For (example)[^1]
444
+ ```
445
+
446
+ Rationale: Reversed links are not rendered as usable links.
447
+
448
+ <a name="md012"></a>
449
+
450
+ ## MD012 - Multiple consecutive blank lines
451
+
452
+ Tags: whitespace, blank_lines
453
+
454
+ Aliases: no-multiple-blanks
455
+
456
+ Parameters: maximum (number; default 1)
457
+
458
+ Fixable: Most violations can be fixed by tooling
459
+
460
+ This rule is triggered when there are multiple consecutive blank lines in the
461
+ document:
462
+
463
+ ```markdown
464
+ Some text here
465
+
466
+
467
+ Some more text here
468
+ ```
469
+
470
+ To fix this, delete the offending lines:
471
+
472
+ ```markdown
473
+ Some text here
474
+
475
+ Some more text here
476
+ ```
477
+
478
+ Note: this rule will not be triggered if there are multiple consecutive blank
479
+ lines inside code blocks.
480
+
481
+ Note: The `maximum` parameter can be used to configure the maximum number of
482
+ consecutive blank lines.
483
+
484
+ Rationale: Except in a code block, blank lines serve no purpose and do not
485
+ affect the rendering of content.
486
+
487
+ <a name="md013"></a>
488
+
489
+ ## MD013 - Line length
490
+
491
+ Tags: line_length
492
+
493
+ Aliases: line-length
494
+
495
+ <!-- markdownlint-disable line-length -->
496
+
497
+ 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))
498
+
499
+ <!-- markdownlint-enable line-length -->
500
+
501
+ > If `headings` is not provided, `headers` (deprecated) will be used.
502
+
503
+ This rule is triggered when there are lines that are longer than the
504
+ configured `line_length` (default: 80 characters). To fix this, split the line
505
+ up into multiple lines. To set a different maximum length for headings, use
506
+ `heading_line_length`. To set a different maximum length for code blocks, use
507
+ `code_block_line_length`
508
+
509
+ This rule has an exception when there is no whitespace beyond the configured
510
+ line length. This allows you to still include items such as long URLs without
511
+ being forced to break them in the middle. To disable this exception, set the
512
+ `strict` parameter to `true` to report an issue when any line is too long.
513
+ To warn for lines that are too long and could be fixed but allow lines without
514
+ spaces, set the `stern` parameter to `true`.
515
+
516
+ For example (assuming normal behavior):
517
+
518
+ ```markdown
519
+ IF THIS LINE IS THE MAXIMUM LENGTH
520
+ This line is okay because there are-no-spaces-beyond-that-length
521
+ And this line is a violation because there are
522
+ This-line-is-also-okay-because-there-are-no-spaces
523
+ ```
524
+
525
+ In `strict` or `stern` modes, the two middle lines above are a violation. The
526
+ third line is a violation in `strict` mode, but allowed in `stern` mode.
527
+
528
+ You have the option to exclude this rule for code blocks, tables, or headings.
529
+ To do so, set the `code_blocks`, `tables`, or `headings` parameter(s) to false.
530
+
531
+ Code blocks are included in this rule by default since it is often a
532
+ requirement for document readability, and tentatively compatible with code
533
+ rules. Still, some languages do not lend themselves to short lines.
534
+
535
+ Rationale: Extremely long lines can be difficult to work with in some editors.
536
+ More information: <https://cirosantilli.com/markdown-style-guide#line-wrapping>.
537
+
538
+ <a name="md014"></a>
539
+
540
+ ## MD014 - Dollar signs used before commands without showing output
541
+
542
+ Tags: code
543
+
544
+ Aliases: commands-show-output
545
+
546
+ Fixable: Most violations can be fixed by tooling
547
+
548
+ This rule is triggered when there are code blocks showing shell commands to be
549
+ typed, and *all* of the shell commands are preceded by dollar signs ($):
550
+
551
+ <!-- markdownlint-disable commands-show-output -->
552
+
553
+ ```markdown
554
+ $ ls
555
+ $ cat foo
556
+ $ less bar
557
+ ```
558
+
559
+ <!-- markdownlint-enable commands-show-output -->
560
+
561
+ The dollar signs are unnecessary in this situation, and should not be
562
+ included:
563
+
564
+ ```markdown
565
+ ls
566
+ cat foo
567
+ less bar
568
+ ```
569
+
570
+ Showing output for commands preceded by dollar signs does not trigger this rule:
571
+
572
+ ```markdown
573
+ $ ls
574
+ foo bar
575
+ $ cat foo
576
+ Hello world
577
+ $ cat bar
578
+ baz
579
+ ```
580
+
581
+ Because some commands do not produce output, it is not a violation if *some*
582
+ commands do not have output:
583
+
584
+ ```markdown
585
+ $ mkdir test
586
+ mkdir: created directory 'test'
587
+ $ ls test
588
+ ```
589
+
590
+ Rationale: It is easier to copy/paste and less noisy if the dollar signs
591
+ are omitted when they are not needed. See
592
+ <https://cirosantilli.com/markdown-style-guide#dollar-signs-in-shell-code>
593
+ for more information.
594
+
595
+ <a name="md018"></a>
596
+
597
+ ## MD018 - No space after hash on atx style heading
598
+
599
+ Tags: headings, headers, atx, spaces
600
+
601
+ Aliases: no-missing-space-atx
602
+
603
+ Fixable: Most violations can be fixed by tooling
604
+
605
+ This rule is triggered when spaces are missing after the hash characters
606
+ in an atx style heading:
607
+
608
+ ```markdown
609
+ #Heading 1
610
+
611
+ ##Heading 2
612
+ ```
613
+
614
+ To fix this, separate the heading text from the hash character by a single
615
+ space:
616
+
617
+ ```markdown
618
+ # Heading 1
619
+
620
+ ## Heading 2
621
+ ```
622
+
623
+ Rationale: Violations of this rule can lead to improperly rendered content.
624
+
625
+ <a name="md019"></a>
626
+
627
+ ## MD019 - Multiple spaces after hash on atx style heading
628
+
629
+ Tags: headings, headers, atx, spaces
630
+
631
+ Aliases: no-multiple-space-atx
632
+
633
+ Fixable: Most violations can be fixed by tooling
634
+
635
+ This rule is triggered when more than one space is used to separate the
636
+ heading text from the hash characters in an atx style heading:
637
+
638
+ ```markdown
639
+ # Heading 1
640
+
641
+ ## Heading 2
642
+ ```
643
+
644
+ To fix this, separate the heading text from the hash character by a single
645
+ space:
646
+
647
+ ```markdown
648
+ # Heading 1
649
+
650
+ ## Heading 2
651
+ ```
652
+
653
+ Rationale: Extra space has no purpose and does not affect the rendering of
654
+ content.
655
+
656
+ <a name="md020"></a>
657
+
658
+ ## MD020 - No space inside hashes on closed atx style heading
659
+
660
+ Tags: headings, headers, atx_closed, spaces
661
+
662
+ Aliases: no-missing-space-closed-atx
663
+
664
+ Fixable: Most violations can be fixed by tooling
665
+
666
+ This rule is triggered when spaces are missing inside the hash characters
667
+ in a closed atx style heading:
668
+
669
+ ```markdown
670
+ #Heading 1#
671
+
672
+ ##Heading 2##
673
+ ```
674
+
675
+ To fix this, separate the heading text from the hash character by a single
676
+ space:
677
+
678
+ ```markdown
679
+ # Heading 1 #
680
+
681
+ ## Heading 2 ##
682
+ ```
683
+
684
+ Note: this rule will fire if either side of the heading is missing spaces.
685
+
686
+ Rationale: Violations of this rule can lead to improperly rendered content.
687
+
688
+ <a name="md021"></a>
689
+
690
+ ## MD021 - Multiple spaces inside hashes on closed atx style heading
691
+
692
+ Tags: headings, headers, atx_closed, spaces
693
+
694
+ Aliases: no-multiple-space-closed-atx
695
+
696
+ Fixable: Most violations can be fixed by tooling
697
+
698
+ This rule is triggered when more than one space is used to separate the
699
+ heading text from the hash characters in a closed atx style heading:
700
+
701
+ ```markdown
702
+ # Heading 1 #
703
+
704
+ ## Heading 2 ##
705
+ ```
706
+
707
+ To fix this, separate the heading text from the hash character by a single
708
+ space:
709
+
710
+ ```markdown
711
+ # Heading 1 #
712
+
713
+ ## Heading 2 ##
714
+ ```
715
+
716
+ Note: this rule will fire if either side of the heading contains multiple
717
+ spaces.
718
+
719
+ Rationale: Extra space has no purpose and does not affect the rendering of
720
+ content.
721
+
722
+ <a name="md022"></a>
723
+
724
+ ## MD022 - Headings should be surrounded by blank lines
725
+
726
+ Tags: headings, headers, blank_lines
727
+
728
+ Aliases: blanks-around-headings, blanks-around-headers
729
+
730
+ Parameters: lines_above, lines_below (number; default 1)
731
+
732
+ Fixable: Most violations can be fixed by tooling
733
+
734
+ This rule is triggered when headings (any style) are either not preceded or not
735
+ followed by at least one blank line:
736
+
737
+ ```markdown
738
+ # Heading 1
739
+ Some text
740
+
741
+ Some more text
742
+ ## Heading 2
743
+ ```
744
+
745
+ To fix this, ensure that all headings have a blank line both before and after
746
+ (except where the heading is at the beginning or end of the document):
747
+
748
+ ```markdown
749
+ # Heading 1
750
+
751
+ Some text
752
+
753
+ Some more text
754
+
755
+ ## Heading 2
756
+ ```
757
+
758
+ The `lines_above` and `lines_below` parameters can be used to specify a different
759
+ number of blank lines (including 0) above or below each heading.
760
+
761
+ Note: If `lines_above` or `lines_below` are configured to require more than one
762
+ blank line, [MD012/no-multiple-blanks](#md012) should also be customized.
763
+
764
+ Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
765
+ not parse headings that don't have a blank line before, and will parse them as
766
+ regular text.
767
+
768
+ <a name="md023"></a>
769
+
770
+ ## MD023 - Headings must start at the beginning of the line
771
+
772
+ Tags: headings, headers, spaces
773
+
774
+ Aliases: heading-start-left, header-start-left
775
+
776
+ Fixable: Most violations can be fixed by tooling
777
+
778
+ This rule is triggered when a heading is indented by one or more spaces:
779
+
780
+ ```markdown
781
+ Some text
782
+
783
+ # Indented heading
784
+ ```
785
+
786
+ To fix this, ensure that all headings start at the beginning of the line:
787
+
788
+ ```markdown
789
+ Some text
790
+
791
+ # Heading
792
+ ```
793
+
794
+ Rationale: Headings that don't start at the beginning of the line will not be
795
+ parsed as headings, and will instead appear as regular text.
796
+
797
+ <a name="md024"></a>
798
+
799
+ ## MD024 - Multiple headings with the same content
800
+
801
+ Tags: headings, headers
802
+
803
+ Aliases: no-duplicate-heading, no-duplicate-header
804
+
805
+ Parameters: siblings_only, allow_different_nesting (boolean; default `false`)
806
+
807
+ This rule is triggered if there are multiple headings in the document that have
808
+ the same text:
809
+
810
+ ```markdown
811
+ # Some text
812
+
813
+ ## Some text
814
+ ```
815
+
816
+ To fix this, ensure that the content of each heading is different:
817
+
818
+ ```markdown
819
+ # Some text
820
+
821
+ ## Some more text
822
+ ```
823
+
824
+ If the parameter `siblings_only` (alternatively `allow_different_nesting`) is
825
+ set to `true`, heading duplication is allowed for non-sibling headings (common
826
+ in change logs):
827
+
828
+ ```markdown
829
+ # Change log
830
+
831
+ ## 1.0.0
832
+
833
+ ### Features
834
+
835
+ ## 2.0.0
836
+
837
+ ### Features
838
+ ```
839
+
840
+ Rationale: Some markdown parsers generate anchors for headings based on the
841
+ heading name; headings with the same content can cause problems with that.
842
+
843
+ <a name="md025"></a>
844
+
845
+ ## MD025 - Multiple top level headings in the same document
846
+
847
+ Tags: headings, headers
848
+
849
+ Aliases: single-title, single-h1
850
+
851
+ Parameters: level, front_matter_title (number; default 1, string; default "^\s*title:")
852
+
853
+ This rule is triggered when a top level heading is in use (the first line of
854
+ the file is a h1 heading), and more than one h1 heading is in use in the
855
+ document:
856
+
857
+ ```markdown
858
+ # Top level heading
859
+
860
+ # Another top level heading
861
+ ```
862
+
863
+ To fix, structure your document so that there is a single h1 heading that is
864
+ the title for the document, and all later headings are h2 or lower level
865
+ headings:
866
+
867
+ ```markdown
868
+ # Title
869
+
870
+ ## Heading
871
+
872
+ ## Another heading
873
+ ```
874
+
875
+ Note: The `level` parameter can be used to change the top level (ex: to h2) in
876
+ cases where a h1 is added externally.
877
+
878
+ If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and contains
879
+ a `title` property (commonly used with blog posts), this rule treats that as a top
880
+ level heading and will report a violation for any subsequent top level headings.
881
+ To use a different property name in front matter, specify the text of a regular
882
+ expression via the `front_matter_title` parameter. To disable the use of front
883
+ matter by this rule, specify `""` for `front_matter_title`.
884
+
885
+ Rationale: A top level heading is a h1 on the first line of the file, and
886
+ serves as the title for the document. If this convention is in use, then there
887
+ can not be more than one title for the document, and the entire document
888
+ should be contained within this heading.
889
+
890
+ <a name="md026"></a>
891
+
892
+ ## MD026 - Trailing punctuation in heading
893
+
894
+ Tags: headings, headers
895
+
896
+ Aliases: no-trailing-punctuation
897
+
898
+ Parameters: punctuation (string; default ".,;:!?。,;:!?")
899
+
900
+ Fixable: Most violations can be fixed by tooling
901
+
902
+ This rule is triggered on any heading that has one of the specified normal or
903
+ full-width punctuation characters as the last character in the line:
904
+
905
+ ```markdown
906
+ # This is a heading.
907
+ ```
908
+
909
+ To fix this, remove the trailing punctuation:
910
+
911
+ ```markdown
912
+ # This is a heading
913
+ ```
914
+
915
+ Note: The `punctuation` parameter can be used to specify what characters count
916
+ as punctuation at the end of a heading. For example, you can change it to
917
+ `".,;:!"` to allow headings that end with a question mark, such as in an FAQ.
918
+ Setting the `punctuation` parameter to `""` allows all characters - and is
919
+ equivalent to disabling the rule.
920
+
921
+ Rationale: Headings are not meant to be full sentences. More information:
922
+ <https://cirosantilli.com/markdown-style-guide#punctuation-at-the-end-of-headers>
923
+
924
+ <a name="md027"></a>
925
+
926
+ ## MD027 - Multiple spaces after blockquote symbol
927
+
928
+ Tags: blockquote, whitespace, indentation
929
+
930
+ Aliases: no-multiple-space-blockquote
931
+
932
+ Fixable: Most violations can be fixed by tooling
933
+
934
+ This rule is triggered when blockquotes have more than one space after the
935
+ blockquote (`>`) symbol:
936
+
937
+ ```markdown
938
+ > This is a block quote with bad indentation
939
+ > there should only be one.
940
+ ```
941
+
942
+ To fix, remove any extraneous space:
943
+
944
+ ```markdown
945
+ > This is a blockquote with correct
946
+ > indentation.
947
+ ```
948
+
949
+ Rationale: Consistent formatting makes it easier to understand a document.
950
+
951
+ <a name="md028"></a>
952
+
953
+ ## MD028 - Blank line inside blockquote
954
+
955
+ Tags: blockquote, whitespace
956
+
957
+ Aliases: no-blanks-blockquote
958
+
959
+ Fixable: Most violations can be fixed by tooling
960
+
961
+ This rule is triggered when two blockquote blocks are separated by nothing
962
+ except for a blank line:
963
+
964
+ ```markdown
965
+ > This is a blockquote
966
+ > which is immediately followed by
967
+
968
+ > this blockquote. Unfortunately
969
+ > In some parsers, these are treated as the same blockquote.
970
+ ```
971
+
972
+ To fix this, ensure that any blockquotes that are right next to each other
973
+ have some text in between:
974
+
975
+ ```markdown
976
+ > This is a blockquote.
977
+
978
+ And Jimmy also said:
979
+
980
+ > This too is a blockquote.
981
+ ```
982
+
983
+ Alternatively, if they are supposed to be the same quote, then add the
984
+ blockquote symbol at the beginning of the blank line:
985
+
986
+ ```markdown
987
+ > This is a blockquote.
988
+ >
989
+ > This is the same blockquote.
990
+ ```
991
+
992
+ Rationale: Some markdown parsers will treat two blockquotes separated by one
993
+ or more blank lines as the same blockquote, while others will treat them as
994
+ separate blockquotes.
995
+
996
+ <a name="md029"></a>
997
+
998
+ ## MD029 - Ordered list item prefix
999
+
1000
+ Tags: ol
1001
+
1002
+ Aliases: ol-prefix
1003
+
1004
+ Parameters: style ("one", "ordered", "one_or_ordered", "zero"; default "one_or_ordered")
1005
+
1006
+ This rule is triggered for ordered lists that do not either start with '1.' or
1007
+ do not have a prefix that increases in numerical order (depending on the
1008
+ configured style). The less-common patterns of using '0.' as a first prefix or
1009
+ for all prefixes is also supported.
1010
+
1011
+ Example valid list if the style is configured as 'one':
1012
+
1013
+ ```markdown
1014
+ 1. Do this.
1015
+ 1. Do that.
1016
+ 1. Done.
1017
+ ```
1018
+
1019
+ Examples of valid lists if the style is configured as 'ordered':
1020
+
1021
+ ```markdown
1022
+ 1. Do this.
1023
+ 2. Do that.
1024
+ 3. Done.
1025
+ ```
1026
+
1027
+ ```markdown
1028
+ 0. Do this.
1029
+ 1. Do that.
1030
+ 2. Done.
1031
+ ```
1032
+
1033
+ All three examples are valid when the style is configured as 'one_or_ordered'.
1034
+
1035
+ Example valid list if the style is configured as 'zero':
1036
+
1037
+ ```markdown
1038
+ 0. Do this.
1039
+ 0. Do that.
1040
+ 0. Done.
1041
+ ```
1042
+
1043
+ Example invalid list for all styles:
1044
+
1045
+ ```markdown
1046
+ 1. Do this.
1047
+ 3. Done.
1048
+ ```
1049
+
1050
+ This rule supports 0-prefixing ordered list items for uniform indentation:
1051
+
1052
+ ```markdown
1053
+ ...
1054
+ 08. Item
1055
+ 09. Item
1056
+ 10. Item
1057
+ 11. Item
1058
+ ...
1059
+ ```
1060
+
1061
+ Note: This rule will report violations for cases like the following where an improperly-indented code block (or similar) appears between two list
1062
+ items and "breaks" the list in two:
1063
+
1064
+ <!-- markdownlint-disable code-fence-style -->
1065
+
1066
+ ~~~markdown
1067
+ 1. First list
1068
+
1069
+ ```text
1070
+ Code block
1071
+ ```
1072
+
1073
+ 1. Second list
1074
+ ~~~
1075
+
1076
+ The fix is to indent the code block so it becomes part of the preceding list item as intended:
1077
+
1078
+ ~~~markdown
1079
+ 1. First list
1080
+
1081
+ ```text
1082
+ Code block
1083
+ ```
1084
+
1085
+ 2. Still first list
1086
+ ~~~
1087
+
1088
+ <!-- markdownlint-enable code-fence-style -->
1089
+
1090
+ Rationale: Consistent formatting makes it easier to understand a document.
1091
+
1092
+ <a name="md030"></a>
1093
+
1094
+ ## MD030 - Spaces after list markers
1095
+
1096
+ Tags: ol, ul, whitespace
1097
+
1098
+ Aliases: list-marker-space
1099
+
1100
+ Parameters: ul_single, ol_single, ul_multi, ol_multi (number; default 1)
1101
+
1102
+ Fixable: Most violations can be fixed by tooling
1103
+
1104
+ This rule checks for the number of spaces between a list marker (e.g. '`-`',
1105
+ '`*`', '`+`' or '`1.`') and the text of the list item.
1106
+
1107
+ The number of spaces checked for depends on the document style in use, but the
1108
+ default is 1 space after any list marker:
1109
+
1110
+ ```markdown
1111
+ * Foo
1112
+ * Bar
1113
+ * Baz
1114
+
1115
+ 1. Foo
1116
+ 1. Bar
1117
+ 1. Baz
1118
+
1119
+ 1. Foo
1120
+ * Bar
1121
+ 1. Baz
1122
+ ```
1123
+
1124
+ A document style may change the number of spaces after unordered list items
1125
+ and ordered list items independently, as well as based on whether the content
1126
+ of every item in the list consists of a single paragraph, or multiple
1127
+ paragraphs (including sub-lists and code blocks).
1128
+
1129
+ For example, the style guide at
1130
+ <https://cirosantilli.com/markdown-style-guide#spaces-after-list-marker>
1131
+ specifies that 1 space after the list marker should be used if every item in
1132
+ the list fits within a single paragraph, but to use 2 or 3 spaces (for ordered
1133
+ and unordered lists respectively) if there are multiple paragraphs of content
1134
+ inside the list:
1135
+
1136
+ ```markdown
1137
+ * Foo
1138
+ * Bar
1139
+ * Baz
1140
+ ```
1141
+
1142
+ vs.
1143
+
1144
+ ```markdown
1145
+ * Foo
1146
+
1147
+ Second paragraph
1148
+
1149
+ * Bar
1150
+ ```
1151
+
1152
+ or
1153
+
1154
+ ```markdown
1155
+ 1. Foo
1156
+
1157
+ Second paragraph
1158
+
1159
+ 1. Bar
1160
+ ```
1161
+
1162
+ To fix this, ensure the correct number of spaces are used after list marker
1163
+ for your selected document style.
1164
+
1165
+ Rationale: Violations of this rule can lead to improperly rendered content.
1166
+
1167
+ <a name="md031"></a>
1168
+
1169
+ ## MD031 - Fenced code blocks should be surrounded by blank lines
1170
+
1171
+ Tags: code, blank_lines
1172
+
1173
+ Aliases: blanks-around-fences
1174
+
1175
+ Parameters: list_items (boolean; default true)
1176
+
1177
+ Fixable: Most violations can be fixed by tooling
1178
+
1179
+ This rule is triggered when fenced code blocks are either not preceded or not
1180
+ followed by a blank line:
1181
+
1182
+ ````markdown
1183
+ Some text
1184
+ ```
1185
+ Code block
1186
+ ```
1187
+
1188
+ ```
1189
+ Another code block
1190
+ ```
1191
+ Some more text
1192
+ ````
1193
+
1194
+ To fix this, ensure that all fenced code blocks have a blank line both before
1195
+ and after (except where the block is at the beginning or end of the document):
1196
+
1197
+ ````markdown
1198
+ Some text
1199
+
1200
+ ```
1201
+ Code block
1202
+ ```
1203
+
1204
+ ```
1205
+ Another code block
1206
+ ```
1207
+
1208
+ Some more text
1209
+ ````
1210
+
1211
+ Set the `list_items` parameter to `false` to disable this rule for list items.
1212
+ Disabling this behavior for lists can be useful if it is necessary to create a
1213
+ [tight](https://spec.commonmark.org/0.29/#tight) list containing a code fence.
1214
+
1215
+ Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
1216
+ not parse fenced code blocks that don't have blank lines before and after them.
1217
+
1218
+ <a name="md032"></a>
1219
+
1220
+ ## MD032 - Lists should be surrounded by blank lines
1221
+
1222
+ Tags: bullet, ul, ol, blank_lines
1223
+
1224
+ Aliases: blanks-around-lists
1225
+
1226
+ Fixable: Most violations can be fixed by tooling
1227
+
1228
+ This rule is triggered when lists (of any kind) are either not preceded or not
1229
+ followed by a blank line:
1230
+
1231
+ ```markdown
1232
+ Some text
1233
+ * Some
1234
+ * List
1235
+
1236
+ 1. Some
1237
+ 2. List
1238
+ Some text
1239
+ ```
1240
+
1241
+ To fix this, ensure that all lists have a blank line both before and after
1242
+ (except where the block is at the beginning or end of the document):
1243
+
1244
+ ```markdown
1245
+ Some text
1246
+
1247
+ * Some
1248
+ * List
1249
+
1250
+ 1. Some
1251
+ 2. List
1252
+
1253
+ Some text
1254
+ ```
1255
+
1256
+ Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
1257
+ not parse lists that don't have blank lines before and after them.
1258
+
1259
+ <a name="md033"></a>
1260
+
1261
+ ## MD033 - Inline HTML
1262
+
1263
+ Tags: html
1264
+
1265
+ Aliases: no-inline-html
1266
+
1267
+ Parameters: allowed_elements (array of string; default empty)
1268
+
1269
+ This rule is triggered whenever raw HTML is used in a markdown document:
1270
+
1271
+ ```markdown
1272
+ <h1>Inline HTML heading</h1>
1273
+ ```
1274
+
1275
+ To fix this, use 'pure' markdown instead of including raw HTML:
1276
+
1277
+ ```markdown
1278
+ # Markdown heading
1279
+ ```
1280
+
1281
+ Note: To allow specific HTML elements, use the 'allowed_elements' parameter.
1282
+
1283
+ Rationale: Raw HTML is allowed in markdown, but this rule is included for
1284
+ those who want their documents to only include "pure" markdown, or for those
1285
+ who are rendering markdown documents in something other than HTML.
1286
+
1287
+ <a name="md034"></a>
1288
+
1289
+ ## MD034 - Bare URL used
1290
+
1291
+ Tags: links, url
1292
+
1293
+ Aliases: no-bare-urls
1294
+
1295
+ Fixable: Most violations can be fixed by tooling
1296
+
1297
+ This rule is triggered whenever a URL is given that isn't surrounded by angle
1298
+ brackets:
1299
+
1300
+ ```markdown
1301
+ For more information, see https://www.example.com/.
1302
+ ```
1303
+
1304
+ To fix this, add angle brackets around the URL:
1305
+
1306
+ ```markdown
1307
+ For more information, see <https://www.example.com/>.
1308
+ ```
1309
+
1310
+ Note: To use a bare URL without it being converted into a link, enclose it in
1311
+ a code block, otherwise in some markdown parsers it _will_ be converted:
1312
+
1313
+ ```markdown
1314
+ `https://www.example.com`
1315
+ ```
1316
+
1317
+ Note: The following scenario does _not_ trigger this rule to avoid conflicts
1318
+ with `MD011`/`no-reversed-links`:
1319
+
1320
+ ```markdown
1321
+ [https://www.example.com]
1322
+ ```
1323
+
1324
+ The use of quotes around a bare link will _not_ trigger this rule, either:
1325
+
1326
+ ```markdown
1327
+ "https://www.example.com"
1328
+ 'https://www.example.com'
1329
+ ```
1330
+
1331
+ Rationale: Without angle brackets, the URL isn't converted into a link by many
1332
+ markdown parsers.
1333
+
1334
+ <a name="md035"></a>
1335
+
1336
+ ## MD035 - Horizontal rule style
1337
+
1338
+ Tags: hr
1339
+
1340
+ Aliases: hr-style
1341
+
1342
+ Parameters: style ("consistent", "---", "***", or other string specifying the
1343
+ horizontal rule; default "consistent")
1344
+
1345
+ This rule is triggered when inconsistent styles of horizontal rules are used
1346
+ in the document:
1347
+
1348
+ ```markdown
1349
+ ---
1350
+
1351
+ - - -
1352
+
1353
+ ***
1354
+
1355
+ * * *
1356
+
1357
+ ****
1358
+ ```
1359
+
1360
+ To fix this, ensure any horizontal rules used in the document are consistent,
1361
+ or match the given style if the rule is so configured:
1362
+
1363
+ ```markdown
1364
+ ---
1365
+
1366
+ ---
1367
+ ```
1368
+
1369
+ Note: by default, this rule is configured to just require that all horizontal
1370
+ rules in the document are the same, and will trigger if any of the horizontal
1371
+ rules are different than the first one encountered in the document. If you
1372
+ want to configure the rule to match a specific style, the parameter given to
1373
+ the 'style' option is a string containing the exact horizontal rule text that
1374
+ is allowed.
1375
+
1376
+ Rationale: Consistent formatting makes it easier to understand a document.
1377
+
1378
+ <a name="md036"></a>
1379
+
1380
+ ## MD036 - Emphasis used instead of a heading
1381
+
1382
+ Tags: headings, headers, emphasis
1383
+
1384
+ Aliases: no-emphasis-as-heading, no-emphasis-as-header
1385
+
1386
+ Parameters: punctuation (string; default ".,;:!?。,;:!?")
1387
+
1388
+ This check looks for instances where emphasized (i.e. bold or italic) text is
1389
+ used to separate sections, where a heading should be used instead:
1390
+
1391
+ ```markdown
1392
+ **My document**
1393
+
1394
+ Lorem ipsum dolor sit amet...
1395
+
1396
+ _Another section_
1397
+
1398
+ Consectetur adipiscing elit, sed do eiusmod.
1399
+ ```
1400
+
1401
+ To fix this, use markdown headings instead of emphasized text to denote
1402
+ sections:
1403
+
1404
+ ```markdown
1405
+ # My document
1406
+
1407
+ Lorem ipsum dolor sit amet...
1408
+
1409
+ ## Another section
1410
+
1411
+ Consectetur adipiscing elit, sed do eiusmod.
1412
+ ```
1413
+
1414
+ Note: This rule looks for single line paragraphs that consist entirely
1415
+ of emphasized text. It won't fire on emphasis used within regular text,
1416
+ multi-line emphasized paragraphs, or paragraphs ending in punctuation
1417
+ (normal or full-width). Similarly to rule MD026, you can configure what
1418
+ characters are recognized as punctuation.
1419
+
1420
+ Rationale: Using emphasis instead of a heading prevents tools from inferring
1421
+ the structure of a document. More information:
1422
+ <https://cirosantilli.com/markdown-style-guide#emphasis-vs-headers>.
1423
+
1424
+ <a name="md037"></a>
1425
+
1426
+ ## MD037 - Spaces inside emphasis markers
1427
+
1428
+ Tags: whitespace, emphasis
1429
+
1430
+ Aliases: no-space-in-emphasis
1431
+
1432
+ Fixable: Most violations can be fixed by tooling
1433
+
1434
+ This rule is triggered when emphasis markers (bold, italic) are used, but they
1435
+ have spaces between the markers and the text:
1436
+
1437
+ ```markdown
1438
+ Here is some ** bold ** text.
1439
+
1440
+ Here is some * italic * text.
1441
+
1442
+ Here is some more __ bold __ text.
1443
+
1444
+ Here is some more _ italic _ text.
1445
+ ```
1446
+
1447
+ To fix this, remove the spaces around the emphasis markers:
1448
+
1449
+ ```markdown
1450
+ Here is some **bold** text.
1451
+
1452
+ Here is some *italic* text.
1453
+
1454
+ Here is some more __bold__ text.
1455
+
1456
+ Here is some more _italic_ text.
1457
+ ```
1458
+
1459
+ Rationale: Emphasis is only parsed as such when the asterisks/underscores
1460
+ aren't completely surrounded by spaces. This rule attempts to detect where
1461
+ they were surrounded by spaces, but it appears that emphasized text was
1462
+ intended by the author.
1463
+
1464
+ <a name="md038"></a>
1465
+
1466
+ ## MD038 - Spaces inside code span elements
1467
+
1468
+ Tags: whitespace, code
1469
+
1470
+ Aliases: no-space-in-code
1471
+
1472
+ Fixable: Most violations can be fixed by tooling
1473
+
1474
+ This rule is triggered for code span elements that have spaces adjacent to the
1475
+ backticks:
1476
+
1477
+ ```markdown
1478
+ `some text `
1479
+
1480
+ ` some text`
1481
+ ```
1482
+
1483
+ To fix this, remove any spaces adjacent to the backticks:
1484
+
1485
+ ```markdown
1486
+ `some text`
1487
+ ```
1488
+
1489
+ Note: A single leading and trailing space is allowed by the specification and
1490
+ automatically trimmed (to allow for embedded backticks):
1491
+
1492
+ ```markdown
1493
+ `` `backticks` ``
1494
+ ```
1495
+
1496
+ Note: A single leading or trailing space is allowed if used to separate codespan
1497
+ markers from an embedded backtick:
1498
+
1499
+ ```markdown
1500
+ `` ` embedded backtick``
1501
+ ```
1502
+
1503
+ Rationale: Violations of this rule can lead to improperly rendered content.
1504
+
1505
+ <a name="md039"></a>
1506
+
1507
+ ## MD039 - Spaces inside link text
1508
+
1509
+ Tags: whitespace, links
1510
+
1511
+ Aliases: no-space-in-links
1512
+
1513
+ Fixable: Most violations can be fixed by tooling
1514
+
1515
+ This rule is triggered on links that have spaces surrounding the link text:
1516
+
1517
+ ```markdown
1518
+ [ a link ](https://www.example.com/)
1519
+ ```
1520
+
1521
+ To fix this, remove the spaces surrounding the link text:
1522
+
1523
+ ```markdown
1524
+ [a link](https://www.example.com/)
1525
+ ```
1526
+
1527
+ Rationale: Consistent formatting makes it easier to understand a document.
1528
+
1529
+ <a name="md040"></a>
1530
+
1531
+ ## MD040 - Fenced code blocks should have a language specified
1532
+
1533
+ Tags: code, language
1534
+
1535
+ Aliases: fenced-code-language
1536
+
1537
+ This rule is triggered when fenced code blocks are used, but a language isn't
1538
+ specified:
1539
+
1540
+ ````markdown
1541
+ ```
1542
+ #!/bin/bash
1543
+ echo Hello world
1544
+ ```
1545
+ ````
1546
+
1547
+ To fix this, add a language specifier to the code block:
1548
+
1549
+ ````markdown
1550
+ ```bash
1551
+ #!/bin/bash
1552
+ echo Hello world
1553
+ ```
1554
+ ````
1555
+
1556
+ Rationale: Specifying a language improves content rendering by using the
1557
+ correct syntax highlighting for code. More information:
1558
+ <https://cirosantilli.com/markdown-style-guide#option-code-fenced>.
1559
+
1560
+ <a name="md041"></a>
1561
+
1562
+ ## MD041 - First line in file should be a top level heading
1563
+
1564
+ Tags: headings, headers
1565
+
1566
+ Aliases: first-line-heading, first-line-h1
1567
+
1568
+ Parameters: level, front_matter_title (number; default 1, string; default "^\s*title:")
1569
+
1570
+ This rule is intended to ensure documents have a title and is triggered when
1571
+ the first line in the file isn't a top level (h1) heading:
1572
+
1573
+ ```markdown
1574
+ This is a file without a heading
1575
+ ```
1576
+
1577
+ To fix this, add a top level heading to the beginning of the file:
1578
+
1579
+ ```markdown
1580
+ # File with heading
1581
+
1582
+ This is a file with a top level heading
1583
+ ```
1584
+
1585
+ Note: The `level` parameter can be used to change the top level (ex: to h2) in cases
1586
+ where a h1 is added externally.
1587
+
1588
+ If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and contains a
1589
+ `title` property (commonly used with blog posts), this rule will not report a
1590
+ violation. To use a different property name in front matter, specify the text
1591
+ of a regular expression via the `front_matter_title` parameter. To disable the
1592
+ use of front matter by this rule, specify `""` for `front_matter_title`.
1593
+
1594
+ Rationale: The top level heading often acts as the title of a document. More
1595
+ information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
1596
+
1597
+ <a name="md042"></a>
1598
+
1599
+ ## MD042 - No empty links
1600
+
1601
+ Tags: links
1602
+
1603
+ Aliases: no-empty-links
1604
+
1605
+ This rule is triggered when an empty link is encountered:
1606
+
1607
+ ```markdown
1608
+ [an empty link]()
1609
+ ```
1610
+
1611
+ To fix the violation, provide a destination for the link:
1612
+
1613
+ ```markdown
1614
+ [a valid link](https://example.com/)
1615
+ ```
1616
+
1617
+ Empty fragments will trigger this rule:
1618
+
1619
+ ```markdown
1620
+ [an empty fragment](#)
1621
+ ```
1622
+
1623
+ But non-empty fragments will not:
1624
+
1625
+ ```markdown
1626
+ [a valid fragment](#fragment)
1627
+ ```
1628
+
1629
+ Rationale: Empty links do not lead anywhere and therefore don't function as links.
1630
+
1631
+ <a name="md043"></a>
1632
+
1633
+ ## MD043 - Required heading structure
1634
+
1635
+ Tags: headings, headers
1636
+
1637
+ Aliases: required-headings, required-headers
1638
+
1639
+ Parameters: headings, headers (array of string; default `null` for disabled)
1640
+
1641
+ > If `headings` is not provided, `headers` (deprecated) will be used.
1642
+
1643
+ This rule is triggered when the headings in a file do not match the array of
1644
+ headings passed to the rule. It can be used to enforce a standard heading
1645
+ structure for a set of files.
1646
+
1647
+ To require exactly the following structure:
1648
+
1649
+ ```markdown
1650
+ # Head
1651
+ ## Item
1652
+ ### Detail
1653
+ ```
1654
+
1655
+ Set the `headings` parameter to:
1656
+
1657
+ ```json
1658
+ [
1659
+ "# Head",
1660
+ "## Item",
1661
+ "### Detail"
1662
+ ]
1663
+ ```
1664
+
1665
+ To allow optional headings as with the following structure:
1666
+
1667
+ ```markdown
1668
+ # Head
1669
+ ## Item
1670
+ ### Detail (optional)
1671
+ ## Foot
1672
+ ### Notes (optional)
1673
+ ```
1674
+
1675
+ Use the special value `"*"` meaning "one or more unspecified headings" and set
1676
+ the `headings` parameter to:
1677
+
1678
+ ```json
1679
+ [
1680
+ "# Head",
1681
+ "## Item",
1682
+ "*",
1683
+ "## Foot",
1684
+ "*"
1685
+ ]
1686
+ ```
1687
+
1688
+ When an error is detected, this rule outputs the line number of the first
1689
+ problematic heading (otherwise, it outputs the last line number of the file).
1690
+
1691
+ Note that while the `headings` parameter uses the "## Text" ATX heading style for
1692
+ simplicity, a file may use any supported heading style.
1693
+
1694
+ Rationale: Projects may wish to enforce a consistent document structure across
1695
+ a set of similar content.
1696
+
1697
+ <a name="md044"></a>
1698
+
1699
+ ## MD044 - Proper names should have the correct capitalization
1700
+
1701
+ Tags: spelling
1702
+
1703
+ Aliases: proper-names
1704
+
1705
+ Parameters: names, code_blocks (string array; default `null`, boolean; default `true`)
1706
+
1707
+ Fixable: Most violations can be fixed by tooling
1708
+
1709
+ This rule is triggered when any of the strings in the `names` array do not have
1710
+ the specified capitalization. It can be used to enforce a standard letter case
1711
+ for the names of projects and products.
1712
+
1713
+ For example, the language "JavaScript" is usually written with both the 'J' and
1714
+ 'S' capitalized - though sometimes the 's' or 'j' appear in lower-case. To enforce
1715
+ the proper capitalization, specify the desired letter case in the `names` array:
1716
+
1717
+ ```json
1718
+ [
1719
+ "JavaScript"
1720
+ ]
1721
+ ```
1722
+
1723
+ Set the `code_blocks` parameter to `false` to disable this rule for code blocks.
1724
+
1725
+ Rationale: Incorrect capitalization of proper names is usually a mistake.
1726
+
1727
+ <a name="md045"></a>
1728
+
1729
+ ## MD045 - Images should have alternate text (alt text)
1730
+
1731
+ Tags: accessibility, images
1732
+
1733
+ Aliases: no-alt-text
1734
+
1735
+ This rule is triggered when an image is missing alternate text (alt text) information.
1736
+
1737
+ Alternate text is commonly specified inline as:
1738
+
1739
+ ```markdown
1740
+ ![Alternate text](image.jpg)
1741
+ ```
1742
+
1743
+ Or with reference syntax as:
1744
+
1745
+ ```markdown
1746
+ ![Alternate text][ref]
1747
+
1748
+ ...
1749
+
1750
+ [ref]: image.jpg "Optional title"
1751
+ ```
1752
+
1753
+ Guidance for writing alternate text is available from the [W3C](https://www.w3.org/WAI/alt/),
1754
+ [Wikipedia](https://en.wikipedia.org/wiki/Alt_attribute), and
1755
+ [other locations](https://www.phase2technology.com/blog/no-more-excuses).
1756
+
1757
+ Rationale: Alternate text is important for accessibility and describes the
1758
+ content of an image for people who may not be able to see it.
1759
+
1760
+ <a name="md046"></a>
1761
+
1762
+ ## MD046 - Code block style
1763
+
1764
+ Tags: code
1765
+
1766
+ Aliases: code-block-style
1767
+
1768
+ Parameters: style ("consistent", "fenced", "indented"; default "consistent")
1769
+
1770
+ This rule is triggered when unwanted or different code block styles are used in
1771
+ the same document.
1772
+
1773
+ In the default configuration this rule reports a violation for the following document:
1774
+
1775
+ <!-- markdownlint-disable code-block-style -->
1776
+
1777
+ Some text.
1778
+
1779
+ # Indented code
1780
+
1781
+ More text.
1782
+
1783
+ ```ruby
1784
+ # Fenced code
1785
+ ```
1786
+
1787
+ More text.
1788
+
1789
+ <!-- markdownlint-enable code-block-style -->
1790
+
1791
+ To fix violations of this rule, use a consistent style (either indenting or code fences).
1792
+
1793
+ The specified style can be specific (`fenced`, `indented`) or simply require that usage
1794
+ be consistent within the document (`consistent`).
1795
+
1796
+ Rationale: Consistent formatting makes it easier to understand a document.
1797
+
1798
+ <a name="md047"></a>
1799
+
1800
+ ## MD047 - Files should end with a single newline character
1801
+
1802
+ Tags: blank_lines
1803
+
1804
+ Aliases: single-trailing-newline
1805
+
1806
+ Fixable: Most violations can be fixed by tooling
1807
+
1808
+ This rule is triggered when there is not a single newline character at the end of a file.
1809
+
1810
+ Example that triggers the rule:
1811
+
1812
+ ```markdown
1813
+ # Heading
1814
+
1815
+ This file ends without a newline.[EOF]
1816
+ ```
1817
+
1818
+ To fix the violation, add a newline character to the end of the file:
1819
+
1820
+ ```markdown
1821
+ # Heading
1822
+
1823
+ This file ends with a newline.
1824
+ [EOF]
1825
+ ```
1826
+
1827
+ Rationale: Some programs have trouble with files that do not end with a newline.
1828
+ More information: <https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file>.
1829
+
1830
+ <a name="md048"></a>
1831
+
1832
+ ## MD048 - Code fence style
1833
+
1834
+ Tags: code
1835
+
1836
+ Aliases: code-fence-style
1837
+
1838
+ Parameters: style ("consistent", "tilde", "backtick"; default "consistent")
1839
+
1840
+ This rule is triggered when the symbols used in the document for fenced code blocks do not match the configured code fence style:
1841
+
1842
+ ````markdown
1843
+ ```ruby
1844
+ # Fenced code
1845
+ ```
1846
+
1847
+ ~~~ruby
1848
+ # Fenced code
1849
+ ~~~
1850
+ ````
1851
+
1852
+ To fix this issue, use the configured code fence style throughout the
1853
+ document:
1854
+
1855
+ ````markdown
1856
+ ```ruby
1857
+ # Fenced code
1858
+ ```
1859
+
1860
+ ```ruby
1861
+ # Fenced code
1862
+ ```
1863
+ ````
1864
+
1865
+ The configured list style can be a specific symbol to use (backtick, tilde), or
1866
+ can require that usage be consistent within the document.
1867
+
1868
+ Rationale: Consistent formatting makes it easier to understand a document.