markdownlint 0.20.0 → 0.20.4

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