@alexlit/lint-kit 189.0.0 → 190.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/package.json +1 -1
  2. package/packages/config-eslint/package.json +6 -6
  3. package/packages/config-eslint/plugins/json.js +1 -1
  4. package/packages/config-eslint/plugins/prettier.js +1 -1
  5. package/packages/config-eslint/plugins/unicorn.js +2 -1
  6. package/packages/config-markdownlint/node_modules/ansi-regex/index.d.ts +33 -0
  7. package/packages/config-markdownlint/node_modules/ansi-regex/index.js +14 -0
  8. package/packages/config-markdownlint/node_modules/ansi-regex/license +9 -0
  9. package/packages/config-markdownlint/node_modules/ansi-regex/package.json +61 -0
  10. package/packages/config-markdownlint/node_modules/ansi-regex/readme.md +66 -0
  11. package/packages/config-markdownlint/node_modules/markdownlint/CHANGELOG.md +529 -0
  12. package/packages/config-markdownlint/node_modules/markdownlint/CONTRIBUTING.md +92 -0
  13. package/packages/config-markdownlint/node_modules/markdownlint/LICENSE +21 -0
  14. package/packages/config-markdownlint/node_modules/markdownlint/README.md +1112 -0
  15. package/packages/config-markdownlint/node_modules/markdownlint/doc/CustomRules.md +194 -0
  16. package/packages/config-markdownlint/node_modules/markdownlint/doc/Prettier.md +27 -0
  17. package/packages/config-markdownlint/node_modules/markdownlint/doc/ReleaseProcess.md +20 -0
  18. package/packages/config-markdownlint/node_modules/markdownlint/doc/Rules.md +2858 -0
  19. package/packages/config-markdownlint/node_modules/markdownlint/doc/md001.md +51 -0
  20. package/packages/config-markdownlint/node_modules/markdownlint/doc/md003.md +59 -0
  21. package/packages/config-markdownlint/node_modules/markdownlint/doc/md004.md +50 -0
  22. package/packages/config-markdownlint/node_modules/markdownlint/doc/md005.md +53 -0
  23. package/packages/config-markdownlint/node_modules/markdownlint/doc/md007.md +52 -0
  24. package/packages/config-markdownlint/node_modules/markdownlint/doc/md009.md +50 -0
  25. package/packages/config-markdownlint/node_modules/markdownlint/doc/md010.md +62 -0
  26. package/packages/config-markdownlint/node_modules/markdownlint/doc/md011.md +30 -0
  27. package/packages/config-markdownlint/node_modules/markdownlint/doc/md012.md +38 -0
  28. package/packages/config-markdownlint/node_modules/markdownlint/doc/md013.md +58 -0
  29. package/packages/config-markdownlint/node_modules/markdownlint/doc/md014.md +54 -0
  30. package/packages/config-markdownlint/node_modules/markdownlint/doc/md018.md +27 -0
  31. package/packages/config-markdownlint/node_modules/markdownlint/doc/md019.md +28 -0
  32. package/packages/config-markdownlint/node_modules/markdownlint/doc/md020.md +29 -0
  33. package/packages/config-markdownlint/node_modules/markdownlint/doc/md021.md +31 -0
  34. package/packages/config-markdownlint/node_modules/markdownlint/doc/md022.md +67 -0
  35. package/packages/config-markdownlint/node_modules/markdownlint/doc/md023.md +33 -0
  36. package/packages/config-markdownlint/node_modules/markdownlint/doc/md024.md +44 -0
  37. package/packages/config-markdownlint/node_modules/markdownlint/doc/md025.md +49 -0
  38. package/packages/config-markdownlint/node_modules/markdownlint/doc/md026.md +40 -0
  39. package/packages/config-markdownlint/node_modules/markdownlint/doc/md027.md +32 -0
  40. package/packages/config-markdownlint/node_modules/markdownlint/doc/md028.md +44 -0
  41. package/packages/config-markdownlint/node_modules/markdownlint/doc/md029.md +100 -0
  42. package/packages/config-markdownlint/node_modules/markdownlint/doc/md030.md +82 -0
  43. package/packages/config-markdownlint/node_modules/markdownlint/doc/md031.md +50 -0
  44. package/packages/config-markdownlint/node_modules/markdownlint/doc/md032.md +55 -0
  45. package/packages/config-markdownlint/node_modules/markdownlint/doc/md033.md +33 -0
  46. package/packages/config-markdownlint/node_modules/markdownlint/doc/md034.md +55 -0
  47. package/packages/config-markdownlint/node_modules/markdownlint/doc/md035.md +44 -0
  48. package/packages/config-markdownlint/node_modules/markdownlint/doc/md036.md +45 -0
  49. package/packages/config-markdownlint/node_modules/markdownlint/doc/md037.md +37 -0
  50. package/packages/config-markdownlint/node_modules/markdownlint/doc/md038.md +52 -0
  51. package/packages/config-markdownlint/node_modules/markdownlint/doc/md039.md +21 -0
  52. package/packages/config-markdownlint/node_modules/markdownlint/doc/md040.md +52 -0
  53. package/packages/config-markdownlint/node_modules/markdownlint/doc/md041.md +64 -0
  54. package/packages/config-markdownlint/node_modules/markdownlint/doc/md042.md +38 -0
  55. package/packages/config-markdownlint/node_modules/markdownlint/doc/md043.md +87 -0
  56. package/packages/config-markdownlint/node_modules/markdownlint/doc/md044.md +45 -0
  57. package/packages/config-markdownlint/node_modules/markdownlint/doc/md045.md +48 -0
  58. package/packages/config-markdownlint/node_modules/markdownlint/doc/md046.md +40 -0
  59. package/packages/config-markdownlint/node_modules/markdownlint/doc/md047.md +34 -0
  60. package/packages/config-markdownlint/node_modules/markdownlint/doc/md048.md +42 -0
  61. package/packages/config-markdownlint/node_modules/markdownlint/doc/md049.md +36 -0
  62. package/packages/config-markdownlint/node_modules/markdownlint/doc/md050.md +35 -0
  63. package/packages/config-markdownlint/node_modules/markdownlint/doc/md051.md +117 -0
  64. package/packages/config-markdownlint/node_modules/markdownlint/doc/md052.md +52 -0
  65. package/packages/config-markdownlint/node_modules/markdownlint/doc/md053.md +38 -0
  66. package/packages/config-markdownlint/node_modules/markdownlint/doc/md054.md +100 -0
  67. package/packages/config-markdownlint/node_modules/markdownlint/doc/md055.md +55 -0
  68. package/packages/config-markdownlint/node_modules/markdownlint/doc/md056.md +37 -0
  69. package/packages/config-markdownlint/node_modules/markdownlint/doc/md058.md +48 -0
  70. package/packages/config-markdownlint/node_modules/markdownlint/doc/md059.md +33 -0
  71. package/packages/config-markdownlint/node_modules/markdownlint/doc/md060.md +130 -0
  72. package/packages/config-markdownlint/node_modules/markdownlint/helpers/LICENSE +21 -0
  73. package/packages/config-markdownlint/node_modules/markdownlint/helpers/README.md +29 -0
  74. package/packages/config-markdownlint/node_modules/markdownlint/helpers/helpers.cjs +695 -0
  75. package/packages/config-markdownlint/node_modules/markdownlint/helpers/micromark-helpers.cjs +332 -0
  76. package/packages/config-markdownlint/node_modules/markdownlint/helpers/package.json +26 -0
  77. package/packages/config-markdownlint/node_modules/markdownlint/helpers/shared.cjs +16 -0
  78. package/packages/config-markdownlint/node_modules/markdownlint/lib/cache.mjs +80 -0
  79. package/packages/config-markdownlint/node_modules/markdownlint/lib/configuration-strict.d.ts +2417 -0
  80. package/packages/config-markdownlint/node_modules/markdownlint/lib/configuration.d.ts +8 -0
  81. package/packages/config-markdownlint/node_modules/markdownlint/lib/constants.mjs +14 -0
  82. package/packages/config-markdownlint/node_modules/markdownlint/lib/defer-require.cjs +18 -0
  83. package/packages/config-markdownlint/node_modules/markdownlint/lib/exports-async.d.mts +1 -0
  84. package/packages/config-markdownlint/node_modules/markdownlint/lib/exports-async.mjs +3 -0
  85. package/packages/config-markdownlint/node_modules/markdownlint/lib/exports-promise.d.mts +1 -0
  86. package/packages/config-markdownlint/node_modules/markdownlint/lib/exports-promise.mjs +3 -0
  87. package/packages/config-markdownlint/node_modules/markdownlint/lib/exports-sync.d.mts +1 -0
  88. package/packages/config-markdownlint/node_modules/markdownlint/lib/exports-sync.mjs +3 -0
  89. package/packages/config-markdownlint/node_modules/markdownlint/lib/exports.d.mts +30 -0
  90. package/packages/config-markdownlint/node_modules/markdownlint/lib/exports.mjs +33 -0
  91. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownit.cjs +171 -0
  92. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.d.mts +615 -0
  93. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.mjs +1592 -0
  94. package/packages/config-markdownlint/node_modules/markdownlint/lib/md001.mjs +32 -0
  95. package/packages/config-markdownlint/node_modules/markdownlint/lib/md003.mjs +47 -0
  96. package/packages/config-markdownlint/node_modules/markdownlint/lib/md004.mjs +72 -0
  97. package/packages/config-markdownlint/node_modules/markdownlint/lib/md005.mjs +69 -0
  98. package/packages/config-markdownlint/node_modules/markdownlint/lib/md007.mjs +84 -0
  99. package/packages/config-markdownlint/node_modules/markdownlint/lib/md009.mjs +96 -0
  100. package/packages/config-markdownlint/node_modules/markdownlint/lib/md010.mjs +78 -0
  101. package/packages/config-markdownlint/node_modules/markdownlint/lib/md011.mjs +56 -0
  102. package/packages/config-markdownlint/node_modules/markdownlint/lib/md012.mjs +40 -0
  103. package/packages/config-markdownlint/node_modules/markdownlint/lib/md013.mjs +91 -0
  104. package/packages/config-markdownlint/node_modules/markdownlint/lib/md014.mjs +47 -0
  105. package/packages/config-markdownlint/node_modules/markdownlint/lib/md018.mjs +43 -0
  106. package/packages/config-markdownlint/node_modules/markdownlint/lib/md019-md021.mjs +77 -0
  107. package/packages/config-markdownlint/node_modules/markdownlint/lib/md020.mjs +68 -0
  108. package/packages/config-markdownlint/node_modules/markdownlint/lib/md022.mjs +103 -0
  109. package/packages/config-markdownlint/node_modules/markdownlint/lib/md023.mjs +37 -0
  110. package/packages/config-markdownlint/node_modules/markdownlint/lib/md024.mjs +45 -0
  111. package/packages/config-markdownlint/node_modules/markdownlint/lib/md025.mjs +45 -0
  112. package/packages/config-markdownlint/node_modules/markdownlint/lib/md026.mjs +46 -0
  113. package/packages/config-markdownlint/node_modules/markdownlint/lib/md027.mjs +50 -0
  114. package/packages/config-markdownlint/node_modules/markdownlint/lib/md028.mjs +39 -0
  115. package/packages/config-markdownlint/node_modules/markdownlint/lib/md029.mjs +84 -0
  116. package/packages/config-markdownlint/node_modules/markdownlint/lib/md030.mjs +57 -0
  117. package/packages/config-markdownlint/node_modules/markdownlint/lib/md031.mjs +61 -0
  118. package/packages/config-markdownlint/node_modules/markdownlint/lib/md032.mjs +78 -0
  119. package/packages/config-markdownlint/node_modules/markdownlint/lib/md033.mjs +46 -0
  120. package/packages/config-markdownlint/node_modules/markdownlint/lib/md034.mjs +92 -0
  121. package/packages/config-markdownlint/node_modules/markdownlint/lib/md035.mjs +23 -0
  122. package/packages/config-markdownlint/node_modules/markdownlint/lib/md036.mjs +55 -0
  123. package/packages/config-markdownlint/node_modules/markdownlint/lib/md037.mjs +94 -0
  124. package/packages/config-markdownlint/node_modules/markdownlint/lib/md038.mjs +73 -0
  125. package/packages/config-markdownlint/node_modules/markdownlint/lib/md039.mjs +59 -0
  126. package/packages/config-markdownlint/node_modules/markdownlint/lib/md040.mjs +32 -0
  127. package/packages/config-markdownlint/node_modules/markdownlint/lib/md041.mjs +71 -0
  128. package/packages/config-markdownlint/node_modules/markdownlint/lib/md042.mjs +58 -0
  129. package/packages/config-markdownlint/node_modules/markdownlint/lib/md043.mjs +72 -0
  130. package/packages/config-markdownlint/node_modules/markdownlint/lib/md044.mjs +110 -0
  131. package/packages/config-markdownlint/node_modules/markdownlint/lib/md045.mjs +61 -0
  132. package/packages/config-markdownlint/node_modules/markdownlint/lib/md046.mjs +31 -0
  133. package/packages/config-markdownlint/node_modules/markdownlint/lib/md047.mjs +28 -0
  134. package/packages/config-markdownlint/node_modules/markdownlint/lib/md048.mjs +47 -0
  135. package/packages/config-markdownlint/node_modules/markdownlint/lib/md049-md050.mjs +115 -0
  136. package/packages/config-markdownlint/node_modules/markdownlint/lib/md051.mjs +173 -0
  137. package/packages/config-markdownlint/node_modules/markdownlint/lib/md052.mjs +40 -0
  138. package/packages/config-markdownlint/node_modules/markdownlint/lib/md053.mjs +60 -0
  139. package/packages/config-markdownlint/node_modules/markdownlint/lib/md054.mjs +122 -0
  140. package/packages/config-markdownlint/node_modules/markdownlint/lib/md055.mjs +72 -0
  141. package/packages/config-markdownlint/node_modules/markdownlint/lib/md056.mjs +50 -0
  142. package/packages/config-markdownlint/node_modules/markdownlint/lib/md058.mjs +57 -0
  143. package/packages/config-markdownlint/node_modules/markdownlint/lib/md059.mjs +71 -0
  144. package/packages/config-markdownlint/node_modules/markdownlint/lib/md060.mjs +209 -0
  145. package/packages/config-markdownlint/node_modules/markdownlint/lib/micromark-parse.mjs +337 -0
  146. package/packages/config-markdownlint/node_modules/markdownlint/lib/micromark-types.d.mts +11 -0
  147. package/packages/config-markdownlint/node_modules/markdownlint/lib/node-imports-browser.mjs +22 -0
  148. package/packages/config-markdownlint/node_modules/markdownlint/lib/node-imports-node.mjs +11 -0
  149. package/packages/config-markdownlint/node_modules/markdownlint/lib/parse-configuration.mjs +47 -0
  150. package/packages/config-markdownlint/node_modules/markdownlint/lib/resolve-module.cjs +52 -0
  151. package/packages/config-markdownlint/node_modules/markdownlint/lib/resolve-module.d.cts +34 -0
  152. package/packages/config-markdownlint/node_modules/markdownlint/lib/rules.mjs +122 -0
  153. package/packages/config-markdownlint/node_modules/markdownlint/lib/types.d.mts +13 -0
  154. package/packages/config-markdownlint/node_modules/markdownlint/package.json +120 -0
  155. package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.jsonc +349 -0
  156. package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.yaml +310 -0
  157. package/packages/config-markdownlint/node_modules/markdownlint/schema/ValidatingConfiguration.md +26 -0
  158. package/packages/config-markdownlint/node_modules/markdownlint/schema/markdownlint-config-schema-strict.json +5138 -0
  159. package/packages/config-markdownlint/node_modules/markdownlint/schema/markdownlint-config-schema.json +5143 -0
  160. package/packages/config-markdownlint/node_modules/markdownlint/style/all.json +5 -0
  161. package/packages/config-markdownlint/node_modules/markdownlint/style/cirosantilli.json +22 -0
  162. package/packages/config-markdownlint/node_modules/markdownlint/style/prettier.json +27 -0
  163. package/packages/config-markdownlint/node_modules/markdownlint/style/relaxed.json +12 -0
  164. package/packages/config-markdownlint/node_modules/string-width/index.d.ts +39 -0
  165. package/packages/config-markdownlint/node_modules/string-width/index.js +203 -0
  166. package/packages/config-markdownlint/node_modules/string-width/license +9 -0
  167. package/packages/config-markdownlint/node_modules/string-width/package.json +65 -0
  168. package/packages/config-markdownlint/node_modules/string-width/readme.md +66 -0
  169. package/packages/config-markdownlint/node_modules/strip-ansi/index.d.ts +15 -0
  170. package/packages/config-markdownlint/node_modules/strip-ansi/index.js +19 -0
  171. package/packages/config-markdownlint/node_modules/strip-ansi/license +9 -0
  172. package/packages/config-markdownlint/node_modules/strip-ansi/package.json +59 -0
  173. package/packages/config-markdownlint/node_modules/strip-ansi/readme.md +37 -0
  174. package/packages/config-markdownlint/package.json +2 -2
  175. package/packages/config-prettier/package.json +2 -2
  176. package/packages/config-stylelint/index.js +1 -1
  177. package/packages/config-stylelint/package.json +3 -3
  178. package/packages/config-stylelint/plugins/scss.js +1 -1
  179. package/packages/config-stylelint/plugins/selector-no-empty.js +1 -1
@@ -0,0 +1,2858 @@
1
+ # Rules
2
+
3
+ This document contains a description of all rules, what they are checking for,
4
+ as well as examples of documents that break the rule and corrected
5
+ versions of the examples.
6
+
7
+ <a name="md001"></a>
8
+
9
+ ## `MD001` - Heading levels should only increment by one level at a time
10
+
11
+ Tags: `headings`
12
+
13
+ Aliases: `heading-increment`
14
+
15
+ Parameters:
16
+
17
+ - `front_matter_title`: RegExp for matching title in front matter (`string`,
18
+ default `^\s*title\s*[:=]`)
19
+
20
+ This rule is triggered when you skip heading levels in a Markdown document, for
21
+ example:
22
+
23
+ ```markdown
24
+ # Heading 1
25
+
26
+ ### Heading 3
27
+
28
+ We skipped out a 2nd level heading in this document
29
+ ```
30
+
31
+ When using multiple heading levels, nested headings should increase by only one
32
+ level at a time:
33
+
34
+ ```markdown
35
+ # Heading 1
36
+
37
+ ## Heading 2
38
+
39
+ ### Heading 3
40
+
41
+ #### Heading 4
42
+
43
+ ## Another Heading 2
44
+
45
+ ### Another Heading 3
46
+ ```
47
+
48
+ If [YAML](https://wikipedia.org/wiki/YAML) front matter is present and
49
+ contains a `title` property (commonly used with blog posts), this rule treats
50
+ that as a top level heading and will report a violation if the actual first
51
+ heading is not a level 2 heading. To use a different property name in the
52
+ front matter, specify the text of a regular expression via the
53
+ `front_matter_title` parameter. To disable the use of front matter by this
54
+ rule, specify `""` for `front_matter_title`. When front matter is not present,
55
+ the first heading can be any level.
56
+
57
+ Rationale: Headings represent the structure of a document and can be confusing
58
+ when skipped - especially for accessibility scenarios. More information:
59
+ <https://www.w3.org/WAI/tutorials/page-structure/headings/>.
60
+
61
+ <a name="md003"></a>
62
+
63
+ ## `MD003` - Heading style
64
+
65
+ Tags: `headings`
66
+
67
+ Aliases: `heading-style`
68
+
69
+ Parameters:
70
+
71
+ - `style`: Heading style (`string`, default `consistent`, values `atx` /
72
+ `atx_closed` / `consistent` / `setext` / `setext_with_atx` /
73
+ `setext_with_atx_closed`)
74
+
75
+ This rule is triggered when different heading styles are used in the same
76
+ document:
77
+
78
+ ```markdown
79
+ # ATX style H1
80
+
81
+ ## Closed ATX style H2 ##
82
+
83
+ Setext style H1
84
+ ===============
85
+ ```
86
+
87
+ To fix the issue, use consistent heading styles throughout the document:
88
+
89
+ ```markdown
90
+ # ATX style H1
91
+
92
+ ## ATX style H2
93
+ ```
94
+
95
+ The `setext_with_atx` and `setext_with_atx_closed` settings allow ATX-style
96
+ headings of level 3 or more in documents with setext-style headings (which only
97
+ support level 1 and 2 headings):
98
+
99
+ ```markdown
100
+ Setext style H1
101
+ ===============
102
+
103
+ Setext style H2
104
+ ---------------
105
+
106
+ ### ATX style H3
107
+ ```
108
+
109
+ Note: The configured heading style can be a specific style to require (`atx`,
110
+ `atx_closed`, `setext`, `setext_with_atx`, `setext_with_atx_closed`), or can
111
+ require that all heading styles match the first heading style via `consistent`.
112
+
113
+ Note: The placement of a horizontal rule directly below a line of text can
114
+ trigger this rule by turning that text into a level 2 setext-style heading:
115
+
116
+ ```markdown
117
+ A line of text followed by a horizontal rule becomes a heading
118
+ ---
119
+ ```
120
+
121
+ Rationale: Consistent formatting makes it easier to understand a document.
122
+
123
+ <a name="md004"></a>
124
+
125
+ ## `MD004` - Unordered list style
126
+
127
+ Tags: `bullet`, `ul`
128
+
129
+ Aliases: `ul-style`
130
+
131
+ Parameters:
132
+
133
+ - `style`: List style (`string`, default `consistent`, values `asterisk` /
134
+ `consistent` / `dash` / `plus` / `sublist`)
135
+
136
+ Fixable: Some violations can be fixed by tooling
137
+
138
+ This rule is triggered when the symbols used in the document for unordered
139
+ list items do not match the configured unordered list style:
140
+
141
+ ```markdown
142
+ * Item 1
143
+ + Item 2
144
+ - Item 3
145
+ ```
146
+
147
+ To fix this issue, use the configured style for list items throughout the
148
+ document:
149
+
150
+ ```markdown
151
+ * Item 1
152
+ * Item 2
153
+ * Item 3
154
+ ```
155
+
156
+ The configured list style can ensure all list styling is a specific symbol
157
+ (`asterisk`, `plus`, `dash`), ensure each sublist has a consistent symbol that
158
+ differs from its parent list (`sublist`), or ensure all list styles match the
159
+ first list style (`consistent`).
160
+
161
+ For example, the following is valid for the `sublist` style because the
162
+ outer-most indent uses asterisk, the middle indent uses plus, and the inner-most
163
+ indent uses dash:
164
+
165
+ ```markdown
166
+ * Item 1
167
+ + Item 2
168
+ - Item 3
169
+ + Item 4
170
+ * Item 4
171
+ + Item 5
172
+ ```
173
+
174
+ Rationale: Consistent formatting makes it easier to understand a document.
175
+
176
+ <a name="md005"></a>
177
+
178
+ ## `MD005` - Inconsistent indentation for list items at the same level
179
+
180
+ Tags: `bullet`, `indentation`, `ul`
181
+
182
+ Aliases: `list-indent`
183
+
184
+ Fixable: Some violations can be fixed by tooling
185
+
186
+ This rule is triggered when list items are parsed as being at the same level,
187
+ but don't have the same indentation:
188
+
189
+ ```markdown
190
+ * Item 1
191
+ * Nested Item 1
192
+ * Nested Item 2
193
+ * A misaligned item
194
+ ```
195
+
196
+ Usually, this rule will be triggered because of a typo. Correct the indentation
197
+ for the list to fix it:
198
+
199
+ ```markdown
200
+ * Item 1
201
+ * Nested Item 1
202
+ * Nested Item 2
203
+ * Nested Item 3
204
+ ```
205
+
206
+ Sequentially-ordered list markers are usually left-aligned such that all items
207
+ have the same starting column:
208
+
209
+ ```markdown
210
+ ...
211
+ 8. Item
212
+ 9. Item
213
+ 10. Item
214
+ 11. Item
215
+ ...
216
+ ```
217
+
218
+ This rule also supports right-alignment of list markers such that all items have
219
+ the same ending column:
220
+
221
+ ```markdown
222
+ ...
223
+ 8. Item
224
+ 9. Item
225
+ 10. Item
226
+ 11. Item
227
+ ...
228
+ ```
229
+
230
+ Rationale: Violations of this rule can lead to improperly rendered content.
231
+
232
+ <a name="md007"></a>
233
+
234
+ ## `MD007` - Unordered list indentation
235
+
236
+ Tags: `bullet`, `indentation`, `ul`
237
+
238
+ Aliases: `ul-indent`
239
+
240
+ Parameters:
241
+
242
+ - `indent`: Spaces for indent (`integer`, default `2`)
243
+ - `start_indent`: Spaces for first level indent (when start_indented is set)
244
+ (`integer`, default `2`)
245
+ - `start_indented`: Whether to indent the first level of the list (`boolean`,
246
+ default `false`)
247
+
248
+ Fixable: Some violations can be fixed by tooling
249
+
250
+ This rule is triggered when list items are not indented by the configured
251
+ number of spaces (default: 2).
252
+
253
+ Example:
254
+
255
+ ```markdown
256
+ * List item
257
+ * Nested list item indented by 3 spaces
258
+ ```
259
+
260
+ Corrected Example:
261
+
262
+ ```markdown
263
+ * List item
264
+ * Nested list item indented by 2 spaces
265
+ ```
266
+
267
+ Note: This rule applies to a sublist only if its parent lists are all also
268
+ unordered (otherwise, extra indentation of ordered lists interferes with the
269
+ rule).
270
+
271
+ The `start_indented` parameter allows the first level of lists to be indented by
272
+ the configured number of spaces rather than starting at zero. The `start_indent`
273
+ parameter allows the first level of lists to be indented by a different number
274
+ of spaces than the rest (ignored when `start_indented` is not set).
275
+
276
+ Rationale: Indenting by 2 spaces allows the content of a nested list to be in
277
+ line with the start of the content of the parent list when a single space is
278
+ used after the list marker. Indenting by 4 spaces is consistent with code blocks
279
+ and simpler for editors to implement. Additionally, this can be a compatibility
280
+ issue for other Markdown parsers, which require 4-space indents. More
281
+ information: [Markdown Style Guide][markdown-style-guide].
282
+
283
+ Note: See [Prettier.md](Prettier.md) for compatibility information.
284
+
285
+ [markdown-style-guide]: https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists
286
+
287
+ <a name="md009"></a>
288
+
289
+ ## `MD009` - Trailing spaces
290
+
291
+ Tags: `whitespace`
292
+
293
+ Aliases: `no-trailing-spaces`
294
+
295
+ Parameters:
296
+
297
+ - `br_spaces`: Spaces for line break (`integer`, default `2`)
298
+ - `code_blocks`: Include code blocks (`boolean`, default `false`)
299
+ - `list_item_empty_lines`: Allow spaces for empty lines in list items
300
+ (`boolean`, default `false`)
301
+ - `strict`: Include unnecessary breaks (`boolean`, default `false`)
302
+
303
+ Fixable: Some violations can be fixed by tooling
304
+
305
+ This rule is triggered on any lines that end with unexpected whitespace. To fix
306
+ this, remove the trailing space from the end of the line.
307
+
308
+ The `br_spaces` parameter allows an exception to this rule for a specific number
309
+ of trailing spaces, typically used to insert an explicit line break. The default
310
+ value allows 2 spaces to indicate a hard break (\<br> element). (You must set
311
+ `br_spaces` to a value >= 2 for this parameter to take effect. Setting
312
+ `br_spaces` to 1 behaves the same as 0, disallowing any trailing spaces.)
313
+
314
+ By default, trailing space is allowed in indented and fenced code blocks because
315
+ some programming languages require that. To report such instances, set the
316
+ `code_blocks` parameter to `true`.
317
+
318
+ By default, this rule will not trigger when the allowed number of spaces is
319
+ used, even when it doesn't create a hard break (for example, at the end of a
320
+ paragraph). To report such instances, set the `strict` parameter to `true`.
321
+
322
+ ```markdown
323
+ Text text text
324
+ text[2 spaces]
325
+ ```
326
+
327
+ Using spaces to indent blank lines inside a list item is usually not necessary,
328
+ but some parsers require it. Set the `list_item_empty_lines` parameter to `true`
329
+ to allow this (even when `strict` is `true`):
330
+
331
+ ```markdown
332
+ - list item text
333
+ [2 spaces]
334
+ list item text
335
+ ```
336
+
337
+ Rationale: Except when being used to create a line break, trailing whitespace
338
+ has no purpose and does not affect the rendering of content.
339
+
340
+ <a name="md010"></a>
341
+
342
+ ## `MD010` - Hard tabs
343
+
344
+ Tags: `hard_tab`, `whitespace`
345
+
346
+ Aliases: `no-hard-tabs`
347
+
348
+ Parameters:
349
+
350
+ - `code_blocks`: Include code blocks (`boolean`, default `true`)
351
+ - `ignore_code_languages`: Fenced code languages to ignore (`string[]`, default
352
+ `[]`)
353
+ - `spaces_per_tab`: Number of spaces for each hard tab (`integer`, default `1`)
354
+
355
+ Fixable: Some violations can be fixed by tooling
356
+
357
+ This rule is triggered by any lines that contain hard tab characters instead
358
+ of using spaces for indentation. To fix this, replace any hard tab characters
359
+ with spaces instead.
360
+
361
+ Example:
362
+
363
+ <!-- markdownlint-disable no-hard-tabs -->
364
+
365
+ ```markdown
366
+ Some text
367
+
368
+ * hard tab character used to indent the list item
369
+ ```
370
+
371
+ <!-- markdownlint-restore -->
372
+
373
+ Corrected example:
374
+
375
+ ```markdown
376
+ Some text
377
+
378
+ * Spaces used to indent the list item instead
379
+ ```
380
+
381
+ You have the option to exclude this rule for code blocks and spans. To do so,
382
+ set the `code_blocks` parameter to `false`. Code blocks and spans are included
383
+ by default since handling of tabs by Markdown tools can be inconsistent (e.g.,
384
+ using 4 vs. 8 spaces).
385
+
386
+ When code blocks are scanned (e.g., by default or if `code_blocks` is `true`),
387
+ the `ignore_code_languages` parameter can be set to a list of languages that
388
+ should be ignored (i.e., hard tabs will be allowed, though not required). This
389
+ makes it easier for documents to include code for languages that require hard
390
+ tabs.
391
+
392
+ By default, violations of this rule are fixed by replacing the tab with 1 space
393
+ character. To use a different number of spaces, set the `spaces_per_tab`
394
+ parameter to the desired value.
395
+
396
+ Rationale: Hard tabs are often rendered inconsistently by different editors and
397
+ can be harder to work with than spaces.
398
+
399
+ More information:
400
+
401
+ - <https://agiletribe.wordpress.com/2011/10/27/18-dont-use-tab-characters/>
402
+ - <https://www.jwz.org/doc/tabs-vs-spaces.html>
403
+ - <https://adamspiers.org/computing/why_no_tabs.html>
404
+
405
+ <a name="md011"></a>
406
+
407
+ ## `MD011` - Reversed link syntax
408
+
409
+ Tags: `links`
410
+
411
+ Aliases: `no-reversed-links`
412
+
413
+ Fixable: Some violations can be fixed by tooling
414
+
415
+ This rule is triggered when text that appears to be a link is encountered, but
416
+ where the syntax appears to have been reversed (the `[]` and `()` are
417
+ reversed):
418
+
419
+ ```markdown
420
+ (Incorrect link syntax)[https://www.example.com/]
421
+ ```
422
+
423
+ To fix this, swap the `[]` and `()` around:
424
+
425
+ ```markdown
426
+ [Correct link syntax](https://www.example.com/)
427
+ ```
428
+
429
+ Note: [Markdown Extra](https://wikipedia.org/wiki/Markdown_Extra)-style
430
+ footnotes do not trigger this rule:
431
+
432
+ ```markdown
433
+ For (example)[^1]
434
+ ```
435
+
436
+ Rationale: Reversed links are not rendered as usable links.
437
+
438
+ <a name="md012"></a>
439
+
440
+ ## `MD012` - Multiple consecutive blank lines
441
+
442
+ Tags: `blank_lines`, `whitespace`
443
+
444
+ Aliases: `no-multiple-blanks`
445
+
446
+ Parameters:
447
+
448
+ - `maximum`: Consecutive blank lines (`integer`, default `1`)
449
+
450
+ Fixable: Some violations can be fixed by tooling
451
+
452
+ This rule is triggered when there are multiple consecutive blank lines in the
453
+ document:
454
+
455
+ ```markdown
456
+ Some text here
457
+
458
+
459
+ Some more text here
460
+ ```
461
+
462
+ To fix this, delete the offending lines:
463
+
464
+ ```markdown
465
+ Some text here
466
+
467
+ Some more text here
468
+ ```
469
+
470
+ Note: this rule will not be triggered if there are multiple consecutive blank
471
+ lines inside code blocks.
472
+
473
+ Note: The `maximum` parameter can be used to configure the maximum number of
474
+ consecutive blank lines.
475
+
476
+ Rationale: Except in a code block, blank lines serve no purpose and do not
477
+ affect the rendering of content.
478
+
479
+ <a name="md013"></a>
480
+
481
+ ## `MD013` - Line length
482
+
483
+ Tags: `line_length`
484
+
485
+ Aliases: `line-length`
486
+
487
+ Parameters:
488
+
489
+ - `code_block_line_length`: Number of characters for code blocks (`integer`,
490
+ default `80`)
491
+ - `code_blocks`: Include code blocks (`boolean`, default `true`)
492
+ - `heading_line_length`: Number of characters for headings (`integer`, default
493
+ `80`)
494
+ - `headings`: Include headings (`boolean`, default `true`)
495
+ - `line_length`: Number of characters (`integer`, default `80`)
496
+ - `stern`: Stern length checking (`boolean`, default `false`)
497
+ - `strict`: Strict length checking (`boolean`, default `false`)
498
+ - `tables`: Include tables (`boolean`, default `true`)
499
+
500
+ This rule is triggered when there are lines that are longer than the
501
+ configured `line_length` (default: 80 characters). To fix this, split the line
502
+ up into multiple lines. To set a different maximum length for headings, use
503
+ `heading_line_length`. To set a different maximum length for code blocks, use
504
+ `code_block_line_length`
505
+
506
+ This rule has an exception when there is no whitespace beyond the configured
507
+ line length. This allows you to include items such as long URLs without being
508
+ forced to break them in the middle. To disable this exception, set the `strict`
509
+ parameter to `true` and an issue will be reported when any line is too long. To
510
+ warn for lines that are too long and could be fixed but allow long lines
511
+ without spaces, set the `stern` parameter to `true`.
512
+
513
+ For example (assuming normal behavior):
514
+
515
+ ```markdown
516
+ IF THIS LINE IS THE MAXIMUM LENGTH
517
+ This line is okay because there are-no-spaces-beyond-that-length
518
+ This line is a violation because there are spaces beyond that length
519
+ This-line-is-okay-because-there-are-no-spaces-anywhere-within
520
+ ```
521
+
522
+ In `strict` mode, the last three lines above are all violations. In `stern`
523
+ mode, the middle two lines above are both violations, but the last is okay.
524
+
525
+ You have the option to exclude this rule for code blocks, tables, or headings.
526
+ To do so, set the `code_blocks`, `tables`, or `headings` parameter(s) to false.
527
+
528
+ Code blocks are included in this rule by default since it is often a
529
+ requirement for document readability, and tentatively compatible with code
530
+ rules. Still, some languages do not lend themselves to short lines.
531
+
532
+ Lines with link/image reference definitions and standalone lines (i.e., not part
533
+ of a paragraph) with only a link/image (possibly using (strong) emphasis) are
534
+ always exempted from this rule (even in `strict` mode) because there is often no
535
+ way to split such lines without breaking the URL.
536
+
537
+ Rationale: Extremely long lines can be difficult to work with in some editors.
538
+ More information: <https://cirosantilli.com/markdown-style-guide#line-wrapping>.
539
+
540
+ <a name="md014"></a>
541
+
542
+ ## `MD014` - Dollar signs used before commands without showing output
543
+
544
+ Tags: `code`
545
+
546
+ Aliases: `commands-show-output`
547
+
548
+ Fixable: Some violations can be fixed by tooling
549
+
550
+ This rule is triggered when there are code blocks showing shell commands to be
551
+ typed, and *all* of the shell commands are preceded by dollar signs ($):
552
+
553
+ <!-- markdownlint-disable commands-show-output -->
554
+
555
+ ```markdown
556
+ $ ls
557
+ $ cat foo
558
+ $ less bar
559
+ ```
560
+
561
+ <!-- markdownlint-restore -->
562
+
563
+ The dollar signs are unnecessary in this situation, and should not be
564
+ included:
565
+
566
+ ```markdown
567
+ ls
568
+ cat foo
569
+ less bar
570
+ ```
571
+
572
+ Showing output for commands preceded by dollar signs does not trigger this rule:
573
+
574
+ ```markdown
575
+ $ ls
576
+ foo bar
577
+ $ cat foo
578
+ Hello world
579
+ $ cat bar
580
+ baz
581
+ ```
582
+
583
+ Because some commands do not produce output, it is not a violation if *some*
584
+ commands do not have output:
585
+
586
+ ```markdown
587
+ $ mkdir test
588
+ mkdir: created directory 'test'
589
+ $ ls test
590
+ ```
591
+
592
+ Rationale: It is easier to copy/paste and less noisy if the dollar signs
593
+ are omitted when they are not needed. See
594
+ <https://cirosantilli.com/markdown-style-guide#dollar-signs-in-shell-code>
595
+ for more information.
596
+
597
+ <a name="md018"></a>
598
+
599
+ ## `MD018` - No space after hash on atx style heading
600
+
601
+ Tags: `atx`, `headings`, `spaces`
602
+
603
+ Aliases: `no-missing-space-atx`
604
+
605
+ Fixable: Some violations can be fixed by tooling
606
+
607
+ This rule is triggered when spaces are missing after the hash characters
608
+ in an atx style heading:
609
+
610
+ ```markdown
611
+ #Heading 1
612
+
613
+ ##Heading 2
614
+ ```
615
+
616
+ To fix this, separate the heading text from the hash character by a single
617
+ space:
618
+
619
+ ```markdown
620
+ # Heading 1
621
+
622
+ ## Heading 2
623
+ ```
624
+
625
+ Rationale: Violations of this rule can lead to improperly rendered content.
626
+
627
+ <a name="md019"></a>
628
+
629
+ ## `MD019` - Multiple spaces after hash on atx style heading
630
+
631
+ Tags: `atx`, `headings`, `spaces`
632
+
633
+ Aliases: `no-multiple-space-atx`
634
+
635
+ Fixable: Some violations can be fixed by tooling
636
+
637
+ This rule is triggered when more than one space is used to separate the
638
+ heading text from the hash characters in an atx style heading:
639
+
640
+ ```markdown
641
+ # Heading 1
642
+
643
+ ## Heading 2
644
+ ```
645
+
646
+ To fix this, separate the heading text from the hash character by a single
647
+ space:
648
+
649
+ ```markdown
650
+ # Heading 1
651
+
652
+ ## Heading 2
653
+ ```
654
+
655
+ Rationale: Extra space has no purpose and does not affect the rendering of
656
+ content.
657
+
658
+ <a name="md020"></a>
659
+
660
+ ## `MD020` - No space inside hashes on closed atx style heading
661
+
662
+ Tags: `atx_closed`, `headings`, `spaces`
663
+
664
+ Aliases: `no-missing-space-closed-atx`
665
+
666
+ Fixable: Some violations can be fixed by tooling
667
+
668
+ This rule is triggered when spaces are missing inside the hash characters
669
+ in a closed atx style heading:
670
+
671
+ ```markdown
672
+ #Heading 1#
673
+
674
+ ##Heading 2##
675
+ ```
676
+
677
+ To fix this, separate the heading text from the hash character by a single
678
+ space:
679
+
680
+ ```markdown
681
+ # Heading 1 #
682
+
683
+ ## Heading 2 ##
684
+ ```
685
+
686
+ Note: this rule will fire if either side of the heading is missing spaces.
687
+
688
+ Rationale: Violations of this rule can lead to improperly rendered content.
689
+
690
+ <a name="md021"></a>
691
+
692
+ ## `MD021` - Multiple spaces inside hashes on closed atx style heading
693
+
694
+ Tags: `atx_closed`, `headings`, `spaces`
695
+
696
+ Aliases: `no-multiple-space-closed-atx`
697
+
698
+ Fixable: Some violations can be fixed by tooling
699
+
700
+ This rule is triggered when more than one space is used to separate the
701
+ heading text from the hash characters in a closed atx style heading:
702
+
703
+ ```markdown
704
+ # Heading 1 #
705
+
706
+ ## Heading 2 ##
707
+ ```
708
+
709
+ To fix this, separate the heading text from the hash character by a single
710
+ space:
711
+
712
+ ```markdown
713
+ # Heading 1 #
714
+
715
+ ## Heading 2 ##
716
+ ```
717
+
718
+ Note: this rule will fire if either side of the heading contains multiple
719
+ spaces.
720
+
721
+ Rationale: Extra space has no purpose and does not affect the rendering of
722
+ content.
723
+
724
+ <a name="md022"></a>
725
+
726
+ ## `MD022` - Headings should be surrounded by blank lines
727
+
728
+ Tags: `blank_lines`, `headings`
729
+
730
+ Aliases: `blanks-around-headings`
731
+
732
+ Parameters:
733
+
734
+ - `include_front_matter`: Include front matter content (`boolean`, default
735
+ `false`)
736
+ - `lines_above`: Blank lines above heading (`integer|integer[]`, default `1`)
737
+ - `lines_below`: Blank lines below heading (`integer|integer[]`, default `1`)
738
+
739
+ Fixable: Some violations can be fixed by tooling
740
+
741
+ This rule is triggered when headings (any style) are either not preceded or not
742
+ followed by at least one blank line:
743
+
744
+ ```markdown
745
+ # Heading 1
746
+ Some text
747
+
748
+ Some more text
749
+ ## Heading 2
750
+ ```
751
+
752
+ To fix this, ensure that all headings have a blank line both before and after
753
+ (except where the heading is at the beginning or end of the document):
754
+
755
+ ```markdown
756
+ # Heading 1
757
+
758
+ Some text
759
+
760
+ Some more text
761
+
762
+ ## Heading 2
763
+ ```
764
+
765
+ The `lines_above` and `lines_below` parameters can be used to specify a
766
+ different number of blank lines (including `0`) above or below each heading.
767
+ If the value `-1` is used for either parameter, any number of blank lines is
768
+ allowed. To customize the number of lines above or below each heading level
769
+ individually, specify a `number[]` where values correspond to heading levels
770
+ 1-6 (in order).
771
+
772
+ Notes: If `lines_above` or `lines_below` are configured to require more than one
773
+ blank line, [MD012/no-multiple-blanks](md012.md) should also be customized. This
774
+ rule checks for *at least* as many blank lines as specified; any extra blank
775
+ lines are ignored.
776
+
777
+ By default, [YAML](https://wikipedia.org/wiki/YAML) front matter is ignored, so
778
+ the following document reports no violations:
779
+
780
+ ```markdown
781
+ ---
782
+ title: Title
783
+ ---
784
+ ## Heading
785
+ ```
786
+
787
+ To require the configured number of blank lines between front matter content and
788
+ a document's first heading, set the `include_front_matter` parameter to `true`.
789
+
790
+ Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`,
791
+ will not parse headings that don't have a blank line before, and will parse them
792
+ as regular text.
793
+
794
+ <a name="md023"></a>
795
+
796
+ ## `MD023` - Headings must start at the beginning of the line
797
+
798
+ Tags: `headings`, `spaces`
799
+
800
+ Aliases: `heading-start-left`
801
+
802
+ Fixable: Some violations can be fixed by tooling
803
+
804
+ This rule is triggered when a heading is indented by one or more spaces:
805
+
806
+ ```markdown
807
+ Some text
808
+
809
+ # Indented heading
810
+ ```
811
+
812
+ To fix this, ensure that all headings start at the beginning of the line:
813
+
814
+ ```markdown
815
+ Some text
816
+
817
+ # Heading
818
+ ```
819
+
820
+ Note that scenarios like block quotes "indent" the start of the line, so the
821
+ following is also correct:
822
+
823
+ ```markdown
824
+ > # Heading in Block Quote
825
+ ```
826
+
827
+ Rationale: Headings that don't start at the beginning of the line will not be
828
+ parsed as headings, and will instead appear as regular text.
829
+
830
+ <a name="md024"></a>
831
+
832
+ ## `MD024` - Multiple headings with the same content
833
+
834
+ Tags: `headings`
835
+
836
+ Aliases: `no-duplicate-heading`
837
+
838
+ Parameters:
839
+
840
+ - `siblings_only`: Only check sibling headings (`boolean`, default `false`)
841
+
842
+ This rule is triggered if there are multiple headings in the document that have
843
+ the same text:
844
+
845
+ ```markdown
846
+ # Some text
847
+
848
+ ## Some text
849
+ ```
850
+
851
+ To fix this, ensure that the content of each heading is different:
852
+
853
+ ```markdown
854
+ # Some text
855
+
856
+ ## Some more text
857
+ ```
858
+
859
+ If the parameter `siblings_only` is set to `true`, duplication is allowed for
860
+ headings with different parents (as is common in changelogs):
861
+
862
+ ```markdown
863
+ # Change log
864
+
865
+ ## 1.0.0
866
+
867
+ ### Features
868
+
869
+ ## 2.0.0
870
+
871
+ ### Features
872
+ ```
873
+
874
+ Rationale: Some Markdown parsers generate anchors for headings based on the
875
+ heading name; headings with the same content can cause problems with that.
876
+
877
+ <a name="md025"></a>
878
+
879
+ ## `MD025` - Multiple top-level headings in the same document
880
+
881
+ Tags: `headings`
882
+
883
+ Aliases: `single-h1`, `single-title`
884
+
885
+ Parameters:
886
+
887
+ - `front_matter_title`: RegExp for matching title in front matter (`string`,
888
+ default `^\s*title\s*[:=]`)
889
+ - `level`: Heading level (`integer`, default `1`)
890
+
891
+ This rule is triggered when a top-level heading is in use (the first line of
892
+ the file is an h1 heading), and more than one h1 heading is in use in the
893
+ document:
894
+
895
+ ```markdown
896
+ # Top level heading
897
+
898
+ # Another top-level heading
899
+ ```
900
+
901
+ To fix, structure your document so there is a single h1 heading that is
902
+ the title for the document. Subsequent headings must be
903
+ lower-level headings (h2, h3, etc.):
904
+
905
+ ```markdown
906
+ # Title
907
+
908
+ ## Heading
909
+
910
+ ## Another heading
911
+ ```
912
+
913
+ Note: The `level` parameter can be used to change the top-level (ex: to h2) in
914
+ cases where an h1 is added externally.
915
+
916
+ If [YAML](https://wikipedia.org/wiki/YAML) front matter is present and
917
+ contains a `title` property (commonly used with blog posts), this rule treats
918
+ that as a top level heading and will report a violation for any subsequent
919
+ top-level headings. To use a different property name in the front matter,
920
+ specify the text of a regular expression via the `front_matter_title` parameter.
921
+ To disable the use of front matter by this rule, specify `""` for
922
+ `front_matter_title`.
923
+
924
+ Rationale: A top-level heading is an h1 on the first line of the file, and
925
+ serves as the title for the document. If this convention is in use, then there
926
+ can not be more than one title for the document, and the entire document should
927
+ be contained within this heading.
928
+
929
+ <a name="md026"></a>
930
+
931
+ ## `MD026` - Trailing punctuation in heading
932
+
933
+ Tags: `headings`
934
+
935
+ Aliases: `no-trailing-punctuation`
936
+
937
+ Parameters:
938
+
939
+ - `punctuation`: Punctuation characters (`string`, default `.,;:!。,;:!`)
940
+
941
+ Fixable: Some violations can be fixed by tooling
942
+
943
+ This rule is triggered on any heading that has one of the specified normal or
944
+ full-width punctuation characters as the last character in the line:
945
+
946
+ ```markdown
947
+ # This is a heading.
948
+ ```
949
+
950
+ To fix this, remove the trailing punctuation:
951
+
952
+ ```markdown
953
+ # This is a heading
954
+ ```
955
+
956
+ Note: The `punctuation` parameter can be used to specify what characters count
957
+ as punctuation at the end of a heading. For example, you can change it to
958
+ `".,;:"` to allow headings that end with an exclamation point. `?` is
959
+ allowed by default because of how common it is in headings of FAQ-style
960
+ documents. Setting the `punctuation` parameter to `""` allows all characters -
961
+ and is equivalent to disabling the rule.
962
+
963
+ Note: The trailing semicolon of [HTML entity references][html-entity-references]
964
+ like `&copy;`, `&#169;`, and `&#x000A9;` is ignored by this rule.
965
+
966
+ Rationale: Headings are not meant to be full sentences. More information:
967
+ [Punctuation at the end of headers][end-punctuation].
968
+
969
+ [end-punctuation]: https://cirosantilli.com/markdown-style-guide#punctuation-at-the-end-of-headers
970
+ [html-entity-references]: https://wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
971
+
972
+ <a name="md027"></a>
973
+
974
+ ## `MD027` - Multiple spaces after blockquote symbol
975
+
976
+ Tags: `blockquote`, `indentation`, `whitespace`
977
+
978
+ Aliases: `no-multiple-space-blockquote`
979
+
980
+ Parameters:
981
+
982
+ - `list_items`: Include list items (`boolean`, default `true`)
983
+
984
+ Fixable: Some violations can be fixed by tooling
985
+
986
+ This rule is triggered when blockquotes have more than one space after the
987
+ blockquote (`>`) symbol:
988
+
989
+ ```markdown
990
+ > This is a blockquote with bad indentation
991
+ > there should only be one.
992
+ ```
993
+
994
+ To fix, remove any extraneous space:
995
+
996
+ ```markdown
997
+ > This is a blockquote with correct
998
+ > indentation.
999
+ ```
1000
+
1001
+ Inferring intended list indentation within a blockquote can be challenging;
1002
+ setting the `list_items` parameter to `false` disables this rule for ordered
1003
+ and unordered list items.
1004
+
1005
+ Rationale: Consistent formatting makes it easier to understand a document.
1006
+
1007
+ <a name="md028"></a>
1008
+
1009
+ ## `MD028` - Blank line inside blockquote
1010
+
1011
+ Tags: `blockquote`, `whitespace`
1012
+
1013
+ Aliases: `no-blanks-blockquote`
1014
+
1015
+ This rule is triggered when two blockquote blocks are separated by nothing
1016
+ but a blank line:
1017
+
1018
+ ```markdown
1019
+ > This is a blockquote
1020
+ > which is immediately followed by
1021
+
1022
+ > this blockquote. In some cases,
1023
+ > these may be merged into one blockquote.
1024
+ ```
1025
+
1026
+ To fix this, ensure that consecutive blockquotes have text (or an HTML comment)
1027
+ in between:
1028
+
1029
+ ```markdown
1030
+ > This is a blockquote.
1031
+
1032
+ This is paragraph text.
1033
+
1034
+ > This is a second blockquote.
1035
+
1036
+ <!-- This is an HTML comment -->
1037
+
1038
+ > This is a third blockquote.
1039
+ ```
1040
+
1041
+ If they are meant to be a single quote, add the blockquote symbol at the
1042
+ beginning of the blank line:
1043
+
1044
+ ```markdown
1045
+ > This is a blockquote.
1046
+ >
1047
+ > This is the same blockquote.
1048
+ ```
1049
+
1050
+ Rationale: Some Markdown parsers will treat two blockquotes separated by one
1051
+ or more blank lines as the same blockquote, while others will treat them as
1052
+ separate blockquotes.
1053
+
1054
+ <a name="md029"></a>
1055
+
1056
+ ## `MD029` - Ordered list item prefix
1057
+
1058
+ Tags: `ol`
1059
+
1060
+ Aliases: `ol-prefix`
1061
+
1062
+ Parameters:
1063
+
1064
+ - `style`: List style (`string`, default `one_or_ordered`, values `one` /
1065
+ `one_or_ordered` / `ordered` / `zero`)
1066
+
1067
+ Fixable: Some violations can be fixed by tooling
1068
+
1069
+ This rule is triggered for ordered lists that do not either start with '1.' or
1070
+ do not have a prefix that increases in numerical order (depending on the
1071
+ configured style). The less-common pattern of using '0.' as a first prefix or
1072
+ for all prefixes is also supported.
1073
+
1074
+ Example valid list if the style is configured as 'one':
1075
+
1076
+ ```markdown
1077
+ 1. Do this.
1078
+ 1. Do that.
1079
+ 1. Done.
1080
+ ```
1081
+
1082
+ Examples of valid lists if the style is configured as 'ordered':
1083
+
1084
+ ```markdown
1085
+ 1. Do this.
1086
+ 2. Do that.
1087
+ 3. Done.
1088
+ ```
1089
+
1090
+ ```markdown
1091
+ 0. Do this.
1092
+ 1. Do that.
1093
+ 2. Done.
1094
+ ```
1095
+
1096
+ All three examples are valid when the style is configured as 'one_or_ordered'.
1097
+
1098
+ Example valid list if the style is configured as 'zero':
1099
+
1100
+ ```markdown
1101
+ 0. Do this.
1102
+ 0. Do that.
1103
+ 0. Done.
1104
+ ```
1105
+
1106
+ Example invalid list for all styles:
1107
+
1108
+ ```markdown
1109
+ 1. Do this.
1110
+ 3. Done.
1111
+ ```
1112
+
1113
+ This rule supports 0-prefixing ordered list items for uniform indentation:
1114
+
1115
+ ```markdown
1116
+ ...
1117
+ 08. Item
1118
+ 09. Item
1119
+ 10. Item
1120
+ 11. Item
1121
+ ...
1122
+ ```
1123
+
1124
+ Note: This rule will report violations for cases like the following where an
1125
+ improperly-indented code block (or similar) appears between two list items and
1126
+ "breaks" the list in two:
1127
+
1128
+ <!-- markdownlint-disable code-fence-style -->
1129
+
1130
+ ~~~markdown
1131
+ 1. First list
1132
+
1133
+ ```text
1134
+ Code block
1135
+ ```
1136
+
1137
+ 1. Second list
1138
+ ~~~
1139
+
1140
+ The fix is to indent the code block so it becomes part of the preceding list
1141
+ item as intended:
1142
+
1143
+ ~~~markdown
1144
+ 1. First list
1145
+
1146
+ ```text
1147
+ Code block
1148
+ ```
1149
+
1150
+ 2. Still first list
1151
+ ~~~
1152
+
1153
+ <!-- markdownlint-restore -->
1154
+
1155
+ Rationale: Consistent formatting makes it easier to understand a document.
1156
+
1157
+ <a name="md030"></a>
1158
+
1159
+ ## `MD030` - Spaces after list markers
1160
+
1161
+ Tags: `ol`, `ul`, `whitespace`
1162
+
1163
+ Aliases: `list-marker-space`
1164
+
1165
+ Parameters:
1166
+
1167
+ - `ol_multi`: Spaces for multi-line ordered list items (`integer`, default `1`)
1168
+ - `ol_single`: Spaces for single-line ordered list items (`integer`, default
1169
+ `1`)
1170
+ - `ul_multi`: Spaces for multi-line unordered list items (`integer`, default
1171
+ `1`)
1172
+ - `ul_single`: Spaces for single-line unordered list items (`integer`, default
1173
+ `1`)
1174
+
1175
+ Fixable: Some violations can be fixed by tooling
1176
+
1177
+ This rule checks for the number of spaces between a list marker (e.g. '`-`',
1178
+ '`*`', '`+`' or '`1.`') and the text of the list item.
1179
+
1180
+ The number of spaces checked for depends on the document style in use, but the
1181
+ default is 1 space after any list marker:
1182
+
1183
+ ```markdown
1184
+ * Foo
1185
+ * Bar
1186
+ * Baz
1187
+
1188
+ 1. Foo
1189
+ 1. Bar
1190
+ 1. Baz
1191
+
1192
+ 1. Foo
1193
+ * Bar
1194
+ 1. Baz
1195
+ ```
1196
+
1197
+ A document style may change the number of spaces after unordered list items
1198
+ and ordered list items independently, as well as based on whether the content
1199
+ of every item in the list consists of a single paragraph or multiple
1200
+ paragraphs (including sub-lists and code blocks).
1201
+
1202
+ For example, the style guide at
1203
+ <https://cirosantilli.com/markdown-style-guide#spaces-after-list-marker>
1204
+ specifies that 1 space after the list marker should be used if every item in
1205
+ the list fits within a single paragraph, but to use 2 or 3 spaces (for ordered
1206
+ and unordered lists respectively) if there are multiple paragraphs of content
1207
+ inside the list:
1208
+
1209
+ ```markdown
1210
+ * Foo
1211
+ * Bar
1212
+ * Baz
1213
+ ```
1214
+
1215
+ vs.
1216
+
1217
+ ```markdown
1218
+ * Foo
1219
+
1220
+ Second paragraph
1221
+
1222
+ * Bar
1223
+ ```
1224
+
1225
+ or
1226
+
1227
+ ```markdown
1228
+ 1. Foo
1229
+
1230
+ Second paragraph
1231
+
1232
+ 1. Bar
1233
+ ```
1234
+
1235
+ To fix this, ensure the correct number of spaces are used after the list marker
1236
+ for your selected document style.
1237
+
1238
+ Rationale: Violations of this rule can lead to improperly rendered content.
1239
+
1240
+ Note: See [Prettier.md](Prettier.md) for compatibility information.
1241
+
1242
+ <a name="md031"></a>
1243
+
1244
+ ## `MD031` - Fenced code blocks should be surrounded by blank lines
1245
+
1246
+ Tags: `blank_lines`, `code`
1247
+
1248
+ Aliases: `blanks-around-fences`
1249
+
1250
+ Parameters:
1251
+
1252
+ - `list_items`: Include list items (`boolean`, default `true`)
1253
+
1254
+ Fixable: Some violations can be fixed by tooling
1255
+
1256
+ This rule is triggered when fenced code blocks are either not preceded or not
1257
+ followed by a blank line:
1258
+
1259
+ ````markdown
1260
+ Some text
1261
+ ```
1262
+ Code block
1263
+ ```
1264
+
1265
+ ```
1266
+ Another code block
1267
+ ```
1268
+ Some more text
1269
+ ````
1270
+
1271
+ To fix this, ensure that all fenced code blocks have a blank line both before
1272
+ and after (except where the block is at the beginning or end of the document):
1273
+
1274
+ ````markdown
1275
+ Some text
1276
+
1277
+ ```
1278
+ Code block
1279
+ ```
1280
+
1281
+ ```
1282
+ Another code block
1283
+ ```
1284
+
1285
+ Some more text
1286
+ ````
1287
+
1288
+ Set the `list_items` parameter to `false` to disable this rule for list items.
1289
+ Disabling this behavior for lists can be useful if it is necessary to create a
1290
+ [tight](https://spec.commonmark.org/0.29/#tight) list containing a code fence.
1291
+
1292
+ Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
1293
+ not parse fenced code blocks that don't have blank lines before and after them.
1294
+
1295
+ <a name="md032"></a>
1296
+
1297
+ ## `MD032` - Lists should be surrounded by blank lines
1298
+
1299
+ Tags: `blank_lines`, `bullet`, `ol`, `ul`
1300
+
1301
+ Aliases: `blanks-around-lists`
1302
+
1303
+ Fixable: Some violations can be fixed by tooling
1304
+
1305
+ This rule is triggered when lists (of any kind) are either not preceded or not
1306
+ followed by a blank line:
1307
+
1308
+ ```markdown
1309
+ Some text
1310
+ * List item
1311
+ * List item
1312
+
1313
+ 1. List item
1314
+ 2. List item
1315
+ ***
1316
+ ```
1317
+
1318
+ In the first case above, text immediately precedes the unordered list. In the
1319
+ second case above, a thematic break immediately follows the ordered list. To fix
1320
+ violations of this rule, ensure that all lists have a blank line both before and
1321
+ after (except when the list is at the very beginning or end of the document):
1322
+
1323
+ ```markdown
1324
+ Some text
1325
+
1326
+ * List item
1327
+ * List item
1328
+
1329
+ 1. List item
1330
+ 2. List item
1331
+
1332
+ ***
1333
+ ```
1334
+
1335
+ Note that the following case is **not** a violation of this rule:
1336
+
1337
+ ```markdown
1338
+ 1. List item
1339
+ More item 1
1340
+ 2. List item
1341
+ More item 2
1342
+ ```
1343
+
1344
+ Although it is not indented, the text "More item 2" is referred to as a
1345
+ [lazy continuation line][lazy-continuation] and considered part of the second
1346
+ list item.
1347
+
1348
+ Rationale: In addition to aesthetic reasons, some parsers, including kramdown,
1349
+ will not parse lists that don't have blank lines before and after them.
1350
+
1351
+ [lazy-continuation]: https://spec.commonmark.org/0.30/#lazy-continuation-line
1352
+
1353
+ <a name="md033"></a>
1354
+
1355
+ ## `MD033` - Inline HTML
1356
+
1357
+ Tags: `html`
1358
+
1359
+ Aliases: `no-inline-html`
1360
+
1361
+ Parameters:
1362
+
1363
+ - `allowed_elements`: Allowed elements (`string[]`, default `[]`)
1364
+ - `table_allowed_elements`: Allowed elements in tables (`string[]`, default
1365
+ `[]`)
1366
+
1367
+ This rule is triggered whenever raw HTML is used in a Markdown document:
1368
+
1369
+ ```markdown
1370
+ <h1>Inline HTML heading</h1>
1371
+ ```
1372
+
1373
+ To fix this, use 'pure' Markdown instead of including raw HTML:
1374
+
1375
+ ```markdown
1376
+ # Markdown heading
1377
+ ```
1378
+
1379
+ To allow specific HTML elements anywhere in Markdown content, set the
1380
+ `allowed_elements` parameter to a list of HTML element names. To allow a
1381
+ specific set of HTML elements within Markdown tables, set the
1382
+ `table_allowed_elements` parameter to a list of HTML element names. This can be
1383
+ used to permit the use of `<br>`-style line breaks only within Markdown tables.
1384
+
1385
+ Rationale: Raw HTML is allowed in Markdown, but this rule is included for
1386
+ those who want their documents to only include "pure" Markdown, or for those
1387
+ who are rendering Markdown documents into something other than HTML.
1388
+
1389
+ <a name="md034"></a>
1390
+
1391
+ ## `MD034` - Bare URL used
1392
+
1393
+ Tags: `links`, `url`
1394
+
1395
+ Aliases: `no-bare-urls`
1396
+
1397
+ Fixable: Some violations can be fixed by tooling
1398
+
1399
+ This rule is triggered whenever a URL or email address appears without
1400
+ surrounding angle brackets:
1401
+
1402
+ ```markdown
1403
+ For more info, visit https://www.example.com/ or email user@example.com.
1404
+ ```
1405
+
1406
+ To fix this, add angle brackets around the URL or email address:
1407
+
1408
+ ```markdown
1409
+ For more info, visit <https://www.example.com/> or email <user@example.com>.
1410
+ ```
1411
+
1412
+ If a URL or email address contains non-ASCII characters, it may be not be
1413
+ handled as intended even when angle brackets are present. In such cases,
1414
+ [percent-encoding](https://wikipedia.org/wiki/Percent-encoding) can be used
1415
+ to comply with the required syntax for URL and email.
1416
+
1417
+ Note: To include a bare URL or email without it being converted into a link,
1418
+ wrap it in a code span:
1419
+
1420
+ ```markdown
1421
+ Not a clickable link: `https://www.example.com`
1422
+ ```
1423
+
1424
+ Note: The following scenario does not trigger this rule because it could be a
1425
+ shortcut link:
1426
+
1427
+ ```markdown
1428
+ [https://www.example.com]
1429
+ ```
1430
+
1431
+ Note: The following syntax triggers this rule because the nested link could be
1432
+ a shortcut link (which takes precedence):
1433
+
1434
+ ```markdown
1435
+ [text [shortcut] text](https://example.com)
1436
+ ```
1437
+
1438
+ To avoid this, escape both inner brackets:
1439
+
1440
+ ```markdown
1441
+ [link \[text\] link](https://example.com)
1442
+ ```
1443
+
1444
+ Rationale: Without angle brackets, a bare URL or email isn't converted into a
1445
+ link by some Markdown parsers.
1446
+
1447
+ <a name="md035"></a>
1448
+
1449
+ ## `MD035` - Horizontal rule style
1450
+
1451
+ Tags: `hr`
1452
+
1453
+ Aliases: `hr-style`
1454
+
1455
+ Parameters:
1456
+
1457
+ - `style`: Horizontal rule style (`string`, default `consistent`)
1458
+
1459
+ This rule is triggered when inconsistent styles of horizontal rules (also known
1460
+ as "thematic breaks") are used in a document:
1461
+
1462
+ ```markdown
1463
+ ---
1464
+
1465
+ - - -
1466
+
1467
+ ***
1468
+
1469
+ * * *
1470
+
1471
+ ****
1472
+ ```
1473
+
1474
+ To fix this, use the same horizontal rule syntax everywhere:
1475
+
1476
+ ```markdown
1477
+ ---
1478
+
1479
+ ---
1480
+
1481
+ ---
1482
+ ```
1483
+
1484
+ The `style` parameter's default value `consistent` ensures all horizontal rules
1485
+ in a document match the first horizontal rule in that document. To enforce a
1486
+ specific pattern of characters, set the `style` parameter to that string (e.g.,
1487
+ `"* * *"`).
1488
+
1489
+ Note: In order to be recognized as a horizontal rule, a line must contain three
1490
+ or more matching `-`, `_`, or `*` characters with optional space between.
1491
+
1492
+ Rationale: Consistent formatting makes it easier to understand a document.
1493
+
1494
+ <a name="md036"></a>
1495
+
1496
+ ## `MD036` - Emphasis used instead of a heading
1497
+
1498
+ Tags: `emphasis`, `headings`
1499
+
1500
+ Aliases: `no-emphasis-as-heading`
1501
+
1502
+ Parameters:
1503
+
1504
+ - `punctuation`: Punctuation characters (`string`, default `.,;:!?。,;:!?`)
1505
+
1506
+ This check looks for instances where emphasized (i.e. bold or italic) text is
1507
+ used to separate sections, where a heading should be used instead:
1508
+
1509
+ ```markdown
1510
+ **My document**
1511
+
1512
+ Lorem ipsum dolor sit amet...
1513
+
1514
+ _Another section_
1515
+
1516
+ Consectetur adipiscing elit, sed do eiusmod.
1517
+ ```
1518
+
1519
+ To fix this, use Markdown headings instead of emphasized text to denote
1520
+ sections:
1521
+
1522
+ ```markdown
1523
+ # My document
1524
+
1525
+ Lorem ipsum dolor sit amet...
1526
+
1527
+ ## Another section
1528
+
1529
+ Consectetur adipiscing elit, sed do eiusmod.
1530
+ ```
1531
+
1532
+ Note: This rule looks for single-line paragraphs that consist entirely
1533
+ of emphasized text. It won't fire on emphasis used within regular text,
1534
+ multi-line emphasized paragraphs, or paragraphs ending in punctuation
1535
+ (normal or full-width). Similarly to rule MD026, you can configure what
1536
+ characters are recognized as punctuation.
1537
+
1538
+ Rationale: Using emphasis instead of a heading prevents tools from inferring
1539
+ the structure of a document. More information:
1540
+ <https://cirosantilli.com/markdown-style-guide#emphasis-vs-headers>.
1541
+
1542
+ <a name="md037"></a>
1543
+
1544
+ ## `MD037` - Spaces inside emphasis markers
1545
+
1546
+ Tags: `emphasis`, `whitespace`
1547
+
1548
+ Aliases: `no-space-in-emphasis`
1549
+
1550
+ Fixable: Some violations can be fixed by tooling
1551
+
1552
+ This rule is triggered when emphasis markers (bold, italic) are used, but they
1553
+ have spaces between the markers and the text:
1554
+
1555
+ ```markdown
1556
+ Here is some ** bold ** text.
1557
+
1558
+ Here is some * italic * text.
1559
+
1560
+ Here is some more __ bold __ text.
1561
+
1562
+ Here is some more _ italic _ text.
1563
+ ```
1564
+
1565
+ To fix this, remove the spaces around the emphasis markers:
1566
+
1567
+ ```markdown
1568
+ Here is some **bold** text.
1569
+
1570
+ Here is some *italic* text.
1571
+
1572
+ Here is some more __bold__ text.
1573
+
1574
+ Here is some more _italic_ text.
1575
+ ```
1576
+
1577
+ Rationale: Emphasis is only parsed as such when the asterisks/underscores
1578
+ aren't surrounded by spaces. This rule attempts to detect where
1579
+ they were surrounded by spaces, but it appears that emphasized text was
1580
+ intended by the author.
1581
+
1582
+ <a name="md038"></a>
1583
+
1584
+ ## `MD038` - Spaces inside code span elements
1585
+
1586
+ Tags: `code`, `whitespace`
1587
+
1588
+ Aliases: `no-space-in-code`
1589
+
1590
+ Fixable: Some violations can be fixed by tooling
1591
+
1592
+ This rule is triggered for code spans containing content with unnecessary space
1593
+ next to the beginning or ending backticks:
1594
+
1595
+ ```markdown
1596
+ `some text `
1597
+
1598
+ ` some text`
1599
+
1600
+ ` some text `
1601
+ ```
1602
+
1603
+ To fix this, remove the extra space characters from the beginning and ending:
1604
+
1605
+ ```markdown
1606
+ `some text`
1607
+ ```
1608
+
1609
+ Note: A single leading *and* trailing space is allowed by the specification and
1610
+ trimmed by the parser to support code spans that begin or end with a backtick:
1611
+
1612
+ ```markdown
1613
+ `` `backticks` ``
1614
+
1615
+ `` backtick` ``
1616
+ ```
1617
+
1618
+ Note: When single-space padding is present in the input, it will be preserved
1619
+ (even if unnecessary):
1620
+
1621
+ ```markdown
1622
+ ` code `
1623
+ ```
1624
+
1625
+ Note: Code spans containing only spaces are allowed by the specification and are
1626
+ also preserved:
1627
+
1628
+ ```markdown
1629
+ ` `
1630
+
1631
+ ` `
1632
+ ```
1633
+
1634
+ Rationale: Violations of this rule are usually unintentional and can lead to
1635
+ improperly-rendered content.
1636
+
1637
+ <a name="md039"></a>
1638
+
1639
+ ## `MD039` - Spaces inside link text
1640
+
1641
+ Tags: `links`, `whitespace`
1642
+
1643
+ Aliases: `no-space-in-links`
1644
+
1645
+ Fixable: Some violations can be fixed by tooling
1646
+
1647
+ This rule is triggered on links that have spaces surrounding the link text:
1648
+
1649
+ ```markdown
1650
+ [ a link ](https://www.example.com/)
1651
+ ```
1652
+
1653
+ To fix this, remove the spaces surrounding the link text:
1654
+
1655
+ ```markdown
1656
+ [a link](https://www.example.com/)
1657
+ ```
1658
+
1659
+ Rationale: Consistent formatting makes it easier to understand a document.
1660
+
1661
+ <a name="md040"></a>
1662
+
1663
+ ## `MD040` - Fenced code blocks should have a language specified
1664
+
1665
+ Tags: `code`, `language`
1666
+
1667
+ Aliases: `fenced-code-language`
1668
+
1669
+ Parameters:
1670
+
1671
+ - `allowed_languages`: List of languages (`string[]`, default `[]`)
1672
+ - `language_only`: Require language only (`boolean`, default `false`)
1673
+
1674
+ This rule is triggered when fenced code blocks are used, but a language isn't
1675
+ specified:
1676
+
1677
+ ````markdown
1678
+ ```
1679
+ #!/bin/bash
1680
+ echo Hello world
1681
+ ```
1682
+ ````
1683
+
1684
+ To fix this, add a language specifier to the code block:
1685
+
1686
+ ````markdown
1687
+ ```bash
1688
+ #!/bin/bash
1689
+ echo Hello world
1690
+ ```
1691
+ ````
1692
+
1693
+ To display a code block without syntax highlighting, use:
1694
+
1695
+ ````markdown
1696
+ ```text
1697
+ Plain text in a code block
1698
+ ```
1699
+ ````
1700
+
1701
+ You can configure the `allowed_languages` parameter to specify a list of
1702
+ languages code blocks could use. Languages are case sensitive. The default value
1703
+ is `[]` which means any language specifier is valid.
1704
+
1705
+ You can prevent extra data from being present in the info string of fenced code
1706
+ blocks. To do so, set the `language_only` parameter to `true`.
1707
+
1708
+ <!-- markdownlint-disable-next-line no-space-in-code -->
1709
+ Info strings with leading/trailing whitespace (ex: `js `) or other content (ex:
1710
+ `ruby startline=3`) will trigger this rule.
1711
+
1712
+ Rationale: Specifying a language improves content rendering by using the
1713
+ correct syntax highlighting for code. More information:
1714
+ <https://cirosantilli.com/markdown-style-guide#option-code-fenced>.
1715
+
1716
+ <a name="md041"></a>
1717
+
1718
+ ## `MD041` - First line in a file should be a top-level heading
1719
+
1720
+ Tags: `headings`
1721
+
1722
+ Aliases: `first-line-h1`, `first-line-heading`
1723
+
1724
+ Parameters:
1725
+
1726
+ - `allow_preamble`: Allow content before first heading (`boolean`, default
1727
+ `false`)
1728
+ - `front_matter_title`: RegExp for matching title in front matter (`string`,
1729
+ default `^\s*title\s*[:=]`)
1730
+ - `level`: Heading level (`integer`, default `1`)
1731
+
1732
+ This rule is intended to ensure documents have a title and is triggered when
1733
+ the first line in a document is not a top-level ([HTML][HTML] `h1`) heading:
1734
+
1735
+ ```markdown
1736
+ This is a document without a heading
1737
+ ```
1738
+
1739
+ To fix this, add a top-level heading to the beginning of the document:
1740
+
1741
+ ```markdown
1742
+ # Document Heading
1743
+
1744
+ This is a document with a top-level heading
1745
+ ```
1746
+
1747
+ Because it is common for projects on GitHub to use an image for the heading of
1748
+ `README.md` and that pattern is not well-supported by Markdown, HTML headings
1749
+ are also permitted by this rule. For example:
1750
+
1751
+ ```markdown
1752
+ <h1 align="center"><img src="https://placekitten.com/300/150"/></h1>
1753
+
1754
+ This is a document with a top-level HTML heading
1755
+ ```
1756
+
1757
+ In some cases, a document's title heading may be preceded by text like a table
1758
+ of contents. This is not ideal for accessibility, but can be allowed by setting
1759
+ the `allow_preamble` parameter to `true`.
1760
+
1761
+ ```markdown
1762
+ This is a document with preamble text
1763
+
1764
+ # Document Heading
1765
+ ```
1766
+
1767
+ If [YAML][YAML] front matter is present and contains a `title` property
1768
+ (commonly used with blog posts), this rule will not report a violation. To use a
1769
+ different property name in the front matter, specify the text of a [regular
1770
+ expression][RegExp] via the `front_matter_title` parameter. To disable the use
1771
+ of front matter by this rule, specify `""` for `front_matter_title`.
1772
+
1773
+ The `level` parameter can be used to change the top-level heading (ex: to `h2`)
1774
+ in cases where an `h1` is added externally.
1775
+
1776
+ Rationale: The top-level heading often acts as the title of a document. More
1777
+ information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
1778
+
1779
+ [HTML]: https://wikipedia.org/wiki/HTML
1780
+ [RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
1781
+ [YAML]: https://wikipedia.org/wiki/YAML
1782
+
1783
+ <a name="md042"></a>
1784
+
1785
+ ## `MD042` - No empty links
1786
+
1787
+ Tags: `links`
1788
+
1789
+ Aliases: `no-empty-links`
1790
+
1791
+ This rule is triggered when an empty link is encountered:
1792
+
1793
+ ```markdown
1794
+ [an empty link]()
1795
+ ```
1796
+
1797
+ To fix the violation, provide a destination for the link:
1798
+
1799
+ ```markdown
1800
+ [a valid link](https://example.com/)
1801
+ ```
1802
+
1803
+ Empty fragments will trigger this rule:
1804
+
1805
+ ```markdown
1806
+ [an empty fragment](#)
1807
+
1808
+ [an empty link definition][empty]
1809
+
1810
+ [empty]: #
1811
+ ```
1812
+
1813
+ But non-empty fragments will not:
1814
+
1815
+ ```markdown
1816
+ [a valid fragment](#fragment)
1817
+ ```
1818
+
1819
+ Empty link definitions
1820
+
1821
+ Rationale: Empty links do not lead anywhere and therefore don't function as
1822
+ links.
1823
+
1824
+ <a name="md043"></a>
1825
+
1826
+ ## `MD043` - Required heading structure
1827
+
1828
+ Tags: `headings`
1829
+
1830
+ Aliases: `required-headings`
1831
+
1832
+ Parameters:
1833
+
1834
+ - `headings`: List of headings (`string[]`, default `[]`)
1835
+ - `match_case`: Match case of headings (`boolean`, default `false`)
1836
+
1837
+ This rule is triggered when the headings in a file do not match the array of
1838
+ headings passed to the rule. It can be used to enforce a standard heading
1839
+ structure for a set of files.
1840
+
1841
+ To require exactly the following structure:
1842
+
1843
+ ```markdown
1844
+ # Heading
1845
+ ## Item
1846
+ ### Detail
1847
+ ```
1848
+
1849
+ Set the `headings` parameter to:
1850
+
1851
+ ```json
1852
+ [
1853
+ "# Heading",
1854
+ "## Item",
1855
+ "### Detail"
1856
+ ]
1857
+ ```
1858
+
1859
+ To allow optional headings as with the following structure:
1860
+
1861
+ ```markdown
1862
+ # Heading
1863
+ ## Item
1864
+ ### Detail (optional)
1865
+ ## Foot
1866
+ ### Notes (optional)
1867
+ ```
1868
+
1869
+ Use the special value `"*"` meaning "zero or more unspecified headings" or the
1870
+ special value `"+"` meaning "one or more unspecified headings" and set the
1871
+ `headings` parameter to:
1872
+
1873
+ ```json
1874
+ [
1875
+ "# Heading",
1876
+ "## Item",
1877
+ "*",
1878
+ "## Foot",
1879
+ "*"
1880
+ ]
1881
+ ```
1882
+
1883
+ To allow a single required heading to vary as with a project name:
1884
+
1885
+ ```markdown
1886
+ # Project Name
1887
+ ## Description
1888
+ ## Examples
1889
+ ```
1890
+
1891
+ Use the special value `"?"` meaning "exactly one unspecified heading":
1892
+
1893
+ ```json
1894
+ [
1895
+ "?",
1896
+ "## Description",
1897
+ "## Examples"
1898
+ ]
1899
+ ```
1900
+
1901
+ When an error is detected, this rule outputs the line number of the first
1902
+ problematic heading (otherwise, it outputs the last line number of the file).
1903
+
1904
+ Note that while the `headings` parameter uses the "## Text" ATX heading style
1905
+ for simplicity, a file may use any supported heading style.
1906
+
1907
+ By default, the case of headings in the document is not required to match that
1908
+ of `headings`. To require that case match exactly, set the `match_case`
1909
+ parameter to `true`.
1910
+
1911
+ Rationale: Projects may wish to enforce a consistent document structure across
1912
+ a set of similar content.
1913
+
1914
+ <a name="md044"></a>
1915
+
1916
+ ## `MD044` - Proper names should have the correct capitalization
1917
+
1918
+ Tags: `spelling`
1919
+
1920
+ Aliases: `proper-names`
1921
+
1922
+ Parameters:
1923
+
1924
+ - `code_blocks`: Include code blocks (`boolean`, default `true`)
1925
+ - `html_elements`: Include HTML elements (`boolean`, default `true`)
1926
+ - `names`: List of proper names (`string[]`, default `[]`)
1927
+
1928
+ Fixable: Some violations can be fixed by tooling
1929
+
1930
+ This rule is triggered when any of the strings in the `names` array do not have
1931
+ the specified capitalization. It can be used to enforce a standard letter case
1932
+ for the names of projects and products.
1933
+
1934
+ For example, the language "JavaScript" is usually written with both the 'J' and
1935
+ 'S' capitalized - though sometimes the 's' or 'j' appear in lower-case. To
1936
+ enforce the proper capitalization, specify the desired letter case in the
1937
+ `names` array:
1938
+
1939
+ ```json
1940
+ [
1941
+ "JavaScript"
1942
+ ]
1943
+ ```
1944
+
1945
+ Sometimes a proper name is capitalized differently in certain contexts. In such
1946
+ cases, add both forms to the `names` array:
1947
+
1948
+ ```json
1949
+ [
1950
+ "GitHub",
1951
+ "github.com"
1952
+ ]
1953
+ ```
1954
+
1955
+ Set the `code_blocks` parameter to `false` to disable this rule for code blocks
1956
+ and spans. Set the `html_elements` parameter to `false` to disable this rule
1957
+ for HTML elements and attributes (such as when using a proper name as part of
1958
+ a path for `a`/`href` or `img`/`src`).
1959
+
1960
+ Rationale: Incorrect capitalization of proper names is usually a mistake.
1961
+
1962
+ <a name="md045"></a>
1963
+
1964
+ ## `MD045` - Images should have alternate text (alt text)
1965
+
1966
+ Tags: `accessibility`, `images`
1967
+
1968
+ Aliases: `no-alt-text`
1969
+
1970
+ This rule reports a violation when an image is missing alternate text (alt text)
1971
+ information.
1972
+
1973
+ Alternate text is commonly specified inline as:
1974
+
1975
+ ```markdown
1976
+ ![Alternate text](image.jpg)
1977
+ ```
1978
+
1979
+ Or with reference syntax as:
1980
+
1981
+ ```markdown
1982
+ ![Alternate text][ref]
1983
+
1984
+ ...
1985
+
1986
+ [ref]: image.jpg "Optional title"
1987
+ ```
1988
+
1989
+ Or with HTML as:
1990
+
1991
+ ```html
1992
+ <img src="image.jpg" alt="Alternate text" />
1993
+ ```
1994
+
1995
+ Note: If the [HTML `aria-hidden` attribute][aria-hidden] is used to hide the
1996
+ image from assistive technology, this rule does not report a violation:
1997
+
1998
+ ```html
1999
+ <img src="image.jpg" aria-hidden="true" />
2000
+ ```
2001
+
2002
+ Guidance for writing alternate text is available from the [W3C][w3c],
2003
+ [Wikipedia][wikipedia], and [other locations][phase2technology].
2004
+
2005
+ Rationale: Alternate text is important for accessibility and describes the
2006
+ content of an image for people who may not be able to see it.
2007
+
2008
+ [aria-hidden]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-hidden
2009
+ [phase2technology]: https://www.phase2technology.com/blog/no-more-excuses
2010
+ [w3c]: https://www.w3.org/WAI/alt/
2011
+ [wikipedia]: https://wikipedia.org/wiki/Alt_attribute
2012
+
2013
+ <a name="md046"></a>
2014
+
2015
+ ## `MD046` - Code block style
2016
+
2017
+ Tags: `code`
2018
+
2019
+ Aliases: `code-block-style`
2020
+
2021
+ Parameters:
2022
+
2023
+ - `style`: Block style (`string`, default `consistent`, values `consistent` /
2024
+ `fenced` / `indented`)
2025
+
2026
+ This rule is triggered when unwanted or different code block styles are used in
2027
+ the same document.
2028
+
2029
+ In the default configuration this rule reports a violation for the following
2030
+ document:
2031
+
2032
+ <!-- markdownlint-disable code-block-style -->
2033
+
2034
+ Some text.
2035
+
2036
+ # Indented code
2037
+
2038
+ More text.
2039
+
2040
+ ```ruby
2041
+ # Fenced code
2042
+ ```
2043
+
2044
+ More text.
2045
+
2046
+ <!-- markdownlint-restore -->
2047
+
2048
+ To fix violations of this rule, use a consistent style (either indenting or code
2049
+ fences).
2050
+
2051
+ The configured code block style can be specific (`fenced`, `indented`) or can
2052
+ require all code blocks match the first code block (`consistent`).
2053
+
2054
+ Rationale: Consistent formatting makes it easier to understand a document.
2055
+
2056
+ <a name="md047"></a>
2057
+
2058
+ ## `MD047` - Files should end with a single newline character
2059
+
2060
+ Tags: `blank_lines`
2061
+
2062
+ Aliases: `single-trailing-newline`
2063
+
2064
+ Fixable: Some violations can be fixed by tooling
2065
+
2066
+ This rule is triggered when there is not a single newline character at the end
2067
+ of a file.
2068
+
2069
+ An example that triggers the rule:
2070
+
2071
+ ```markdown
2072
+ # Heading
2073
+
2074
+ This file ends without a newline.[EOF]
2075
+ ```
2076
+
2077
+ To fix the violation, add a newline character to the end of the file:
2078
+
2079
+ ```markdown
2080
+ # Heading
2081
+
2082
+ This file ends with a newline.
2083
+ [EOF]
2084
+ ```
2085
+
2086
+ Rationale: Some programs have trouble with files that do not end with a newline.
2087
+
2088
+ More information: [What's the point in adding a new line to the end of a
2089
+ file?][stack-exchange]
2090
+
2091
+ [stack-exchange]: https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file
2092
+
2093
+ <a name="md048"></a>
2094
+
2095
+ ## `MD048` - Code fence style
2096
+
2097
+ Tags: `code`
2098
+
2099
+ Aliases: `code-fence-style`
2100
+
2101
+ Parameters:
2102
+
2103
+ - `style`: Code fence style (`string`, default `consistent`, values `backtick`
2104
+ / `consistent` / `tilde`)
2105
+
2106
+ This rule is triggered when the symbols used in the document for fenced code
2107
+ blocks do not match the configured code fence style:
2108
+
2109
+ ````markdown
2110
+ ```ruby
2111
+ # Fenced code
2112
+ ```
2113
+
2114
+ ~~~ruby
2115
+ # Fenced code
2116
+ ~~~
2117
+ ````
2118
+
2119
+ To fix this issue, use the configured code fence style throughout the
2120
+ document:
2121
+
2122
+ ````markdown
2123
+ ```ruby
2124
+ # Fenced code
2125
+ ```
2126
+
2127
+ ```ruby
2128
+ # Fenced code
2129
+ ```
2130
+ ````
2131
+
2132
+ The configured code fence style can be a specific symbol to use (`backtick`,
2133
+ `tilde`) or it can require all code fences match the first code fence
2134
+ (`consistent`).
2135
+
2136
+ Rationale: Consistent formatting makes it easier to understand a document.
2137
+
2138
+ <a name="md049"></a>
2139
+
2140
+ ## `MD049` - Emphasis style
2141
+
2142
+ Tags: `emphasis`
2143
+
2144
+ Aliases: `emphasis-style`
2145
+
2146
+ Parameters:
2147
+
2148
+ - `style`: Emphasis style (`string`, default `consistent`, values `asterisk` /
2149
+ `consistent` / `underscore`)
2150
+
2151
+ Fixable: Some violations can be fixed by tooling
2152
+
2153
+ This rule is triggered when the symbols used in the document for emphasis do not
2154
+ match the configured emphasis style:
2155
+
2156
+ ```markdown
2157
+ *Text*
2158
+ _Text_
2159
+ ```
2160
+
2161
+ To fix this issue, use the configured emphasis style throughout the document:
2162
+
2163
+ ```markdown
2164
+ *Text*
2165
+ *Text*
2166
+ ```
2167
+
2168
+ The configured emphasis style can be a specific symbol to use (`asterisk`,
2169
+ `underscore`) or can require all emphasis matches the first emphasis
2170
+ (`consistent`).
2171
+
2172
+ Note: Emphasis within a word is restricted to `asterisk` in order to avoid
2173
+ unwanted emphasis for words containing internal underscores like_this_one.
2174
+
2175
+ Rationale: Consistent formatting makes it easier to understand a document.
2176
+
2177
+ <a name="md050"></a>
2178
+
2179
+ ## `MD050` - Strong style
2180
+
2181
+ Tags: `emphasis`
2182
+
2183
+ Aliases: `strong-style`
2184
+
2185
+ Parameters:
2186
+
2187
+ - `style`: Strong style (`string`, default `consistent`, values `asterisk` /
2188
+ `consistent` / `underscore`)
2189
+
2190
+ Fixable: Some violations can be fixed by tooling
2191
+
2192
+ This rule is triggered when the symbols used in the document for strong do not
2193
+ match the configured strong style:
2194
+
2195
+ ```markdown
2196
+ **Text**
2197
+ __Text__
2198
+ ```
2199
+
2200
+ To fix this issue, use the configured strong style throughout the document:
2201
+
2202
+ ```markdown
2203
+ **Text**
2204
+ **Text**
2205
+ ```
2206
+
2207
+ The configured strong style can be a specific symbol to use (`asterisk`,
2208
+ `underscore`) or can require all strong matches the first strong (`consistent`).
2209
+
2210
+ Note: Emphasis within a word is restricted to `asterisk` in order to avoid
2211
+ unwanted emphasis for words containing internal underscores like__this__one.
2212
+
2213
+ Rationale: Consistent formatting makes it easier to understand a document.
2214
+
2215
+ <a name="md051"></a>
2216
+
2217
+ ## `MD051` - Link fragments should be valid
2218
+
2219
+ Tags: `links`
2220
+
2221
+ Aliases: `link-fragments`
2222
+
2223
+ Parameters:
2224
+
2225
+ - `ignore_case`: Ignore case of fragments (`boolean`, default `false`)
2226
+ - `ignored_pattern`: Pattern for ignoring additional fragments (`string`,
2227
+ default ``)
2228
+
2229
+ Fixable: Some violations can be fixed by tooling
2230
+
2231
+ This rule is triggered when a link fragment does not match any of the fragments
2232
+ that are automatically generated for headings in a document:
2233
+
2234
+ ```markdown
2235
+ # Heading Name
2236
+
2237
+ [Link](#fragment)
2238
+ ```
2239
+
2240
+ To fix this issue, change the link fragment to reference an existing heading's
2241
+ generated name (see below):
2242
+
2243
+ ```markdown
2244
+ # Heading Name
2245
+
2246
+ [Link](#heading-name)
2247
+ ```
2248
+
2249
+ For consistency, this rule requires fragments to exactly match the [GitHub
2250
+ heading algorithm][github-heading-algorithm] which converts letters to
2251
+ lowercase. Therefore, the following example is reported as a violation:
2252
+
2253
+ ```markdown
2254
+ # Heading Name
2255
+
2256
+ [Link](#Heading-Name)
2257
+ ```
2258
+
2259
+ To ignore case when comparing fragments with heading names, the `ignore_case`
2260
+ parameter can be set to `true`. In this configuration, the previous example is
2261
+ not reported as a violation.
2262
+
2263
+ Alternatively, some platforms allow the syntax `{#named-anchor}` to be used
2264
+ within a heading to provide a specific name (consisting of only lower-case
2265
+ letters, numbers, `-`, and `_`):
2266
+
2267
+ ```markdown
2268
+ # Heading Name {#custom-name}
2269
+
2270
+ [Link](#custom-name)
2271
+ ```
2272
+
2273
+ Alternatively, any HTML tag with an `id` attribute or an `a` tag with a `name`
2274
+ attribute can be used to define a fragment:
2275
+
2276
+ ```markdown
2277
+ <a id="bookmark"></a>
2278
+
2279
+ [Link](#bookmark)
2280
+ ```
2281
+
2282
+ An `a` tag can be useful in scenarios where a heading is not appropriate or for
2283
+ control over the text of the fragment identifier.
2284
+
2285
+ [HTML links to `#top` scroll to the top of a document][html-top-fragment]. This
2286
+ rule allows that syntax (using lower-case for consistency):
2287
+
2288
+ ```markdown
2289
+ [Link](#top)
2290
+ ```
2291
+
2292
+ This rule also recognizes the custom fragment syntax used by GitHub to highlight
2293
+ [specific content in a document][github-linking-to-content].
2294
+
2295
+ For example, this link to line 20:
2296
+
2297
+ ```markdown
2298
+ [Link](#L20)
2299
+ ```
2300
+
2301
+ And this link to content starting within line 19 running into line 21:
2302
+
2303
+ ```markdown
2304
+ [Link](#L19C5-L21C11)
2305
+ ```
2306
+
2307
+ Some Markdown generators dynamically create and insert headings when building
2308
+ documents, for example by combining a fixed prefix like `figure-` and an
2309
+ incrementing numeric counter. To ignore such generated fragments, set the
2310
+ `ignored_pattern` [regular expression][RegEx] parameter to a pattern that
2311
+ matches (e.g., `^figure-`).
2312
+
2313
+ Rationale: [GitHub section links][github-section-links] are created
2314
+ automatically for every heading when Markdown content is displayed on GitHub.
2315
+ This makes it easy to link directly to different sections within a document.
2316
+ However, section links change if headings are renamed or removed. This rule
2317
+ helps identify broken section links within a document.
2318
+
2319
+ Note: Section links are **not** part of the CommonMark specification; this rule
2320
+ enforces the [GitHub heading algorithm][github-heading-algorithm]:
2321
+
2322
+ 1. Convert text to lowercase
2323
+ 2. Remove punctuation characters
2324
+ 3. Convert spaces to dashes
2325
+ 4. Append an incrementing integer (as needed for uniqueness)
2326
+ 5. [URI-encode][encodeURIComponent] the result
2327
+
2328
+ [encodeURIComponent]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
2329
+ [github-section-links]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links
2330
+ [github-heading-algorithm]: https://github.com/gjtorikian/html-pipeline/blob/f13a1534cb650ba17af400d1acd3a22c28004c09/lib/html/pipeline/toc_filter.rb
2331
+ [github-linking-to-content]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-a-permanent-link-to-a-code-snippet#linking-to-markdown
2332
+ [html-top-fragment]: https://html.spec.whatwg.org/multipage/browsing-the-web.html#scrolling-to-a-fragment
2333
+ [RegEx]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
2334
+
2335
+ <a name="md052"></a>
2336
+
2337
+ ## `MD052` - Reference links and images should use a label that is defined
2338
+
2339
+ Tags: `images`, `links`
2340
+
2341
+ Aliases: `reference-links-images`
2342
+
2343
+ Parameters:
2344
+
2345
+ - `ignored_labels`: Ignored link labels (`string[]`, default `["x"]`)
2346
+ - `shortcut_syntax`: Include shortcut syntax (`boolean`, default `false`)
2347
+
2348
+ Links and images in Markdown can provide the link destination or image source
2349
+ at the time of use or can define it elsewhere and use a label for reference.
2350
+ The reference format is convenient for keeping paragraph text clutter-free
2351
+ and makes it easy to reuse the same URL in multiple places.
2352
+
2353
+ There are three kinds of reference links and images:
2354
+
2355
+ ```markdown
2356
+ Full: [text][label]
2357
+ Collapsed: [label][]
2358
+ Shortcut: [label]
2359
+
2360
+ Full: ![text][image]
2361
+ Collapsed: ![image][]
2362
+ Shortcut: ![image]
2363
+
2364
+ [label]: https://example.com/label
2365
+ [image]: https://example.com/image
2366
+ ```
2367
+
2368
+ A link or image renders correctly when the corresponding label is defined, but
2369
+ displays as text with brackets when the label is not present. By default, this
2370
+ rule warns of undefined labels for "full" and "collapsed" reference syntax but
2371
+ not for "shortcut" syntax because it is ambiguous.
2372
+
2373
+ The text `[example]` could be a shortcut link or the text "example" in brackets,
2374
+ so "shortcut" syntax is ignored by default. To include "shortcut" syntax, set
2375
+ the `include_shortcut` parameter to `true`. Note that doing so produces warnings
2376
+ for *all* text in the document that *could* be a shortcut. If bracketed text is
2377
+ intentional, brackets can be escaped with the `\` character: `\[example\]`.
2378
+
2379
+ If there are link labels that are deliberately unreferenced, they can be ignored
2380
+ by setting the `ignored_labels` parameter to the list of strings to ignore. The
2381
+ default value of this parameter ignores the checkbox syntax used by
2382
+ [GitHub Flavored Markdown task list items][gfm-tasklist]:
2383
+
2384
+ ```markdown
2385
+ - [x] Checked task list item
2386
+ ```
2387
+
2388
+ [gfm-tasklist]: https://github.github.com/gfm/#task-list-items-extension-
2389
+
2390
+ <a name="md053"></a>
2391
+
2392
+ ## `MD053` - Link and image reference definitions should be needed
2393
+
2394
+ Tags: `images`, `links`
2395
+
2396
+ Aliases: `link-image-reference-definitions`
2397
+
2398
+ Parameters:
2399
+
2400
+ - `ignored_definitions`: Ignored definitions (`string[]`, default `["//"]`)
2401
+
2402
+ Fixable: Some violations can be fixed by tooling
2403
+
2404
+ Links and images in Markdown can provide the link destination or image source
2405
+ at the time of use or can use a label to reference a definition elsewhere in
2406
+ the document. The latter reference format is convenient for keeping paragraph
2407
+ text clutter-free and makes it easy to reuse the same URL in multiple places.
2408
+
2409
+ Because link and image reference definitions are located separately from
2410
+ where they are used, there are two scenarios where a definition can be
2411
+ unnecessary:
2412
+
2413
+ 1. If a label is not referenced by any link or image in a document, that
2414
+ definition is unused and can be deleted.
2415
+ 2. If a label is defined multiple times in a document, the first definition is
2416
+ used and the others can be deleted.
2417
+
2418
+ This rule considers a reference definition to be used if any link or image
2419
+ reference has the corresponding label. The "full", "collapsed", and "shortcut"
2420
+ formats are all supported.
2421
+
2422
+ If there are reference definitions that are deliberately unreferenced, they can
2423
+ be ignored by setting the `ignored_definitions` parameter to the list of strings
2424
+ to ignore. The default value of this parameter ignores the following convention
2425
+ for adding non-HTML comments to Markdown:
2426
+
2427
+ ```markdown
2428
+ [//]: # (This behaves like a comment)
2429
+ ```
2430
+
2431
+ <a name="md054"></a>
2432
+
2433
+ ## `MD054` - Link and image style
2434
+
2435
+ Tags: `images`, `links`
2436
+
2437
+ Aliases: `link-image-style`
2438
+
2439
+ Parameters:
2440
+
2441
+ - `autolink`: Allow autolinks (`boolean`, default `true`)
2442
+ - `collapsed`: Allow collapsed reference links and images (`boolean`, default
2443
+ `true`)
2444
+ - `full`: Allow full reference links and images (`boolean`, default `true`)
2445
+ - `inline`: Allow inline links and images (`boolean`, default `true`)
2446
+ - `shortcut`: Allow shortcut reference links and images (`boolean`, default
2447
+ `true`)
2448
+ - `url_inline`: Allow URLs as inline links (`boolean`, default `true`)
2449
+
2450
+ Fixable: Some violations can be fixed by tooling
2451
+
2452
+ Links and images in Markdown can provide the link destination or image source at
2453
+ the time of use or can use a label to reference a definition elsewhere in the
2454
+ document. The three reference formats are convenient for keeping paragraph text
2455
+ clutter-free and make it easy to reuse the same URL in multiple places.
2456
+
2457
+ By default, this rule allows all link/image styles.
2458
+
2459
+ Setting the `autolink` parameter to `false` disables autolinks:
2460
+
2461
+ ```markdown
2462
+ <https://example.com>
2463
+ ```
2464
+
2465
+ Setting the `inline` parameter to `false` disables inline links and images:
2466
+
2467
+ ```markdown
2468
+ [link](https://example.com)
2469
+
2470
+ ![image](https://example.com)
2471
+ ```
2472
+
2473
+ Setting the `full` parameter to `false` disables full reference links and
2474
+ images:
2475
+
2476
+ ```markdown
2477
+ [link][url]
2478
+
2479
+ ![image][url]
2480
+
2481
+ [url]: https://example.com
2482
+ ```
2483
+
2484
+ Setting the `collapsed` parameter to `false` disables collapsed reference links
2485
+ and images:
2486
+
2487
+ ```markdown
2488
+ [url][]
2489
+
2490
+ ![url][]
2491
+
2492
+ [url]: https://example.com
2493
+ ```
2494
+
2495
+ Setting the `shortcut` parameter to `false` disables shortcut reference links
2496
+ and images:
2497
+
2498
+ ```markdown
2499
+ [url]
2500
+
2501
+ ![url]
2502
+
2503
+ [url]: https://example.com
2504
+ ```
2505
+
2506
+ To fix violations of this rule, change the link or image to use an allowed
2507
+ style. This rule can automatically fix violations when a link or image can be
2508
+ converted to the `inline` style (preferred) or a link can be converted to the
2509
+ `autolink` style (which does not support images and must be an absolute URL).
2510
+ This rule does *not* fix scenarios that require converting a link or image to
2511
+ the `full`, `collapsed`, or `shortcut` reference styles because that involves
2512
+ naming the reference and determining where to insert it in the document.
2513
+
2514
+ Setting the `url_inline` parameter to `false` prevents the use of inline links
2515
+ with the same absolute URL text/destination and no title because such links can
2516
+ be converted to autolinks:
2517
+
2518
+ ```markdown
2519
+ [https://example.com](https://example.com)
2520
+ ```
2521
+
2522
+ To fix `url_inline` violations, use the simpler autolink syntax instead:
2523
+
2524
+ ```markdown
2525
+ <https://example.com>
2526
+ ```
2527
+
2528
+ Rationale: Consistent formatting makes it easier to understand a document.
2529
+ Autolinks are concise, but appear as URLs which can be long and confusing.
2530
+ Inline links and images can include descriptive text, but take up more space in
2531
+ Markdown form. Reference links and images can be easier to read and manipulate
2532
+ in Markdown form, but require a separate link reference definition.
2533
+
2534
+ <a name="md055"></a>
2535
+
2536
+ ## `MD055` - Table pipe style
2537
+
2538
+ Tags: `table`
2539
+
2540
+ Aliases: `table-pipe-style`
2541
+
2542
+ Parameters:
2543
+
2544
+ - `style`: Table pipe style (`string`, default `consistent`, values
2545
+ `consistent` / `leading_and_trailing` / `leading_only` /
2546
+ `no_leading_or_trailing` / `trailing_only`)
2547
+
2548
+ This rule is triggered when a [GitHub Flavored Markdown table][gfm-table-055]
2549
+ is inconsistent about its use of leading and trailing pipe characters (`|`).
2550
+
2551
+ By default (`consistent` style), the header row of the first table in a document
2552
+ is used to determine the style that is enforced for every table in the document.
2553
+ A specific style can be used instead (`leading_and_trailing`, `leading_only`,
2554
+ `no_leading_or_trailing`, `trailing_only`).
2555
+
2556
+ This table's header row has leading and trailing pipes, but its delimiter row is
2557
+ missing the trailing pipe and its first row of cells is missing the leading
2558
+ pipe:
2559
+
2560
+ ```markdown
2561
+ | Header | Header |
2562
+ | ------ | ------
2563
+ Cell | Cell |
2564
+ ```
2565
+
2566
+ To fix these issues, make sure there is a pipe character at the beginning and
2567
+ end of every row:
2568
+
2569
+ ```markdown
2570
+ | Header | Header |
2571
+ | ------ | ------ |
2572
+ | Cell | Cell |
2573
+ ```
2574
+
2575
+ Note that text immediately following a table (i.e., not separated by an empty
2576
+ line) is treated as part of the table (per the specification) and may also
2577
+ trigger this rule:
2578
+
2579
+ ```markdown
2580
+ | Header | Header |
2581
+ | ------ | ------ |
2582
+ | Cell | Cell |
2583
+ This text is part of the table
2584
+ ```
2585
+
2586
+ Rationale: Some parsers have difficulty with tables that are missing their
2587
+ leading or trailing pipe characters. The use of leading/trailing pipes can also
2588
+ help provide visual clarity.
2589
+
2590
+ [gfm-table-055]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
2591
+
2592
+ <a name="md056"></a>
2593
+
2594
+ ## `MD056` - Table column count
2595
+
2596
+ Tags: `table`
2597
+
2598
+ Aliases: `table-column-count`
2599
+
2600
+ This rule is triggered when a [GitHub Flavored Markdown table][gfm-table-056]
2601
+ does not have the same number of cells in every row.
2602
+
2603
+ This table's second data row has too few cells and its third data row has too
2604
+ many cells:
2605
+
2606
+ ```markdown
2607
+ | Header | Header |
2608
+ | ------ | ------ |
2609
+ | Cell | Cell |
2610
+ | Cell |
2611
+ | Cell | Cell | Cell |
2612
+ ```
2613
+
2614
+ To fix these issues, ensure every row has the same number of cells:
2615
+
2616
+ ```markdown
2617
+ | Header | Header |
2618
+ | ------ | ------ |
2619
+ | Cell | Cell |
2620
+ | Cell | Cell |
2621
+ | Cell | Cell |
2622
+ ```
2623
+
2624
+ Note that a table's header row and its delimiter row must have the same number
2625
+ of cells or it will not be recognized as a table (per specification).
2626
+
2627
+ Rationale: Extra cells in a row are usually not shown, so their data is lost.
2628
+ Missing cells in a row create holes in the table and suggest an omission.
2629
+
2630
+ [gfm-table-056]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
2631
+
2632
+ <a name="md058"></a>
2633
+
2634
+ ## `MD058` - Tables should be surrounded by blank lines
2635
+
2636
+ Tags: `table`
2637
+
2638
+ Aliases: `blanks-around-tables`
2639
+
2640
+ Fixable: Some violations can be fixed by tooling
2641
+
2642
+ This rule is triggered when tables are either not preceded or not followed by a
2643
+ blank line:
2644
+
2645
+ ```markdown
2646
+ Some text
2647
+ | Header | Header |
2648
+ | ------ | ------ |
2649
+ | Cell | Cell |
2650
+ > Blockquote
2651
+ ```
2652
+
2653
+ To fix violations of this rule, ensure that all tables have a blank line both
2654
+ before and after (except when the table is at the very beginning or end of the
2655
+ document):
2656
+
2657
+ ```markdown
2658
+ Some text
2659
+
2660
+ | Header | Header |
2661
+ | ------ | ------ |
2662
+ | Cell | Cell |
2663
+
2664
+ > Blockquote
2665
+ ```
2666
+
2667
+ Note that text immediately following a table (i.e., not separated by an empty
2668
+ line) is treated as part of the table (per the specification) and will not
2669
+ trigger this rule:
2670
+
2671
+ ```markdown
2672
+ | Header | Header |
2673
+ | ------ | ------ |
2674
+ | Cell | Cell |
2675
+ This text is part of the table and the next line is blank
2676
+
2677
+ Some text
2678
+ ```
2679
+
2680
+ Rationale: In addition to aesthetic reasons, some parsers will incorrectly parse
2681
+ tables that don't have blank lines before and after them.
2682
+
2683
+ <a name="md059"></a>
2684
+
2685
+ ## `MD059` - Link text should be descriptive
2686
+
2687
+ Tags: `accessibility`, `links`
2688
+
2689
+ Aliases: `descriptive-link-text`
2690
+
2691
+ Parameters:
2692
+
2693
+ - `prohibited_texts`: Prohibited link texts (`string[]`, default `["click
2694
+ here","here","link","more"]`)
2695
+
2696
+ This rule is triggered when a link has generic text like `[click here](...)` or
2697
+ `[link](...)`.
2698
+
2699
+ Link text should be descriptive and communicate the purpose of the link (e.g.,
2700
+ `[Download the budget document](...)` or `[CommonMark Specification](...)`).
2701
+ This is especially important for screen readers which sometimes present links
2702
+ without context.
2703
+
2704
+ By default, this rule prohibits a small number of common English words/phrases.
2705
+ To customize that list of words/phrases, set the `prohibited_texts` parameter to
2706
+ an `Array` of `string`s.
2707
+
2708
+ Note: For languages other than English, use the `prohibited_texts` parameter to
2709
+ customize the list for that language. It is *not* a goal for this rule to have
2710
+ translations for every language.
2711
+
2712
+ Note: This rule checks Markdown links; HTML links are ignored.
2713
+
2714
+ More information:
2715
+
2716
+ - <https://webaim.org/techniques/hypertext/>
2717
+ - <https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-link-only.html>
2718
+
2719
+ <a name="md060"></a>
2720
+
2721
+ ## `MD060` - Table column style
2722
+
2723
+ Tags: `table`
2724
+
2725
+ Aliases: `table-column-style`
2726
+
2727
+ Parameters:
2728
+
2729
+ - `aligned_delimiter`: Aligned delimiter columns (`boolean`, default `false`)
2730
+ - `style`: Table column style (`string`, default `any`, values `aligned` /
2731
+ `any` / `compact` / `tight`)
2732
+
2733
+ Fixable: Some violations can be fixed by tooling
2734
+
2735
+ This rule is triggered when the column separator pipe characters (`|`) of a
2736
+ [GitHub Flavored Markdown table][gfm-table-060] are used inconsistently.
2737
+
2738
+ This rule recognizes three table column styles based on popular use.
2739
+
2740
+ Style `aligned` ensures pipe characters are vertically aligned:
2741
+
2742
+ ```markdown
2743
+ | Character | Meaning |
2744
+ | --------- | ------- |
2745
+ | Y | Yes |
2746
+ | N | No |
2747
+ ```
2748
+
2749
+ The `aligned` style ignores cell content, so the following is also valid:
2750
+
2751
+ ```markdown
2752
+ | Character | Meaning |
2753
+ |-----------|---------|
2754
+ | Y | Yes |
2755
+ | N | No |
2756
+ ```
2757
+
2758
+ Style `compact` avoids extra padding with a single space around cell content:
2759
+
2760
+ ```markdown
2761
+ | Character | Meaning |
2762
+ | --- | --- |
2763
+ | Y | Yes |
2764
+ | N | No |
2765
+ ```
2766
+
2767
+ Style `tight` uses no padding at all for cell content:
2768
+
2769
+ ```markdown
2770
+ |Character|Meaning|
2771
+ |---|---|
2772
+ |Y|Yes|
2773
+ |N|No|
2774
+ ```
2775
+
2776
+ When this rule's `style` parameter is set to `aligned`, `compact`, or `tight`,
2777
+ every table must match the corresponding pattern and any violations will be
2778
+ reported. By default, or when the `any` style is used, each table is analyzed to
2779
+ see if it satisfies any supported style. If so, no violations are reported. If
2780
+ not, violations are be reported for whichever style would produce the *fewest*
2781
+ issues (i.e., whichever style is the closest match).
2782
+
2783
+ Setting the `aligned_delimiter` parameter to `true` requires pipe characters in
2784
+ the delimiter row to align with those in the header row. This can be used with
2785
+ `compact` and `tight` tables to make the header text more obvious. (It's already
2786
+ required for tables with style `aligned`.)
2787
+
2788
+ Style `compact` with `aligned_delimiter`:
2789
+
2790
+ ```markdown
2791
+ | Character | Meaning |
2792
+ | --------- | ------- |
2793
+ | Y | Yes |
2794
+ | N | No |
2795
+ ```
2796
+
2797
+ Style `tight` with `aligned_delimiter`:
2798
+
2799
+ ```markdown
2800
+ |Character|Meaning|
2801
+ |---------|-------|
2802
+ |Y|Yes|
2803
+ |N|No|
2804
+ ```
2805
+
2806
+ Violations for styles `compact` and `tight` are simple/independent and can be
2807
+ fixed automatically. However, fixing even single violations for style `aligned`
2808
+ may require modifying the entire table, and therefore are not automatic:
2809
+
2810
+ ```markdown
2811
+ |Alpha |Delta|
2812
+ |------|-----|
2813
+ |Charlie|Beta|
2814
+ ```
2815
+
2816
+ **Note**: This rule does not require leading/trailing pipe characters, so this
2817
+ is also a valid table for style `compact`:
2818
+
2819
+ ```markdown
2820
+ Character | Meaning
2821
+ --- | ---
2822
+ Y | Yes
2823
+ N | No
2824
+ ```
2825
+
2826
+ **Note**: Pipe alignment for the `aligned` style is based on visual appearance
2827
+ and not character count. Because editors typically render [emoji][emoji] and
2828
+ [CJK characters][cjk-characters] at *twice* the width of
2829
+ [Latin characters][latin-script], this rule takes that into account for tables
2830
+ using the `aligned` style. The following table is correctly formatted and will
2831
+ appear aligned in most editors and monospaced fonts:
2832
+
2833
+ <!-- markdownlint-capture -->
2834
+ <!-- markdownlint-disable extended-ascii -->
2835
+
2836
+ ```markdown
2837
+ | Response | Emoji |
2838
+ | -------- | ----- |
2839
+ | Yes | ✅ |
2840
+ | No | ❎ |
2841
+ ```
2842
+
2843
+ <!-- markdownlint-restore -->
2844
+
2845
+ Rationale: Consistent formatting makes it easier to understand a document.
2846
+
2847
+ [cjk-characters]: https://wikipedia.org/wiki/CJK_characters
2848
+ [emoji]: https://wikipedia.org/wiki/Emoji
2849
+ [gfm-table-060]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
2850
+ [latin-script]: https://wikipedia.org/wiki/Latin_script
2851
+
2852
+ <!-- markdownlint-configure-file {
2853
+ "no-inline-html": {
2854
+ "allowed_elements": [
2855
+ "a"
2856
+ ]
2857
+ }
2858
+ } -->