@alexlit/lint-kit 107.2.2 → 108.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 (256) hide show
  1. package/.eslintrc.cjs +9 -0
  2. package/.linthtmlrc.cjs +5 -0
  3. package/{.commitlintrc.js → commitlint.config.js} +1 -1
  4. package/package.json +11 -10
  5. package/packages/config-commitlint/LICENSE +20 -0
  6. package/packages/config-commitlint/README.md +5 -9
  7. package/packages/config-commitlint/index.js +1 -1
  8. package/packages/config-commitlint/package.json +4 -3
  9. package/packages/config-eslint/LICENSE +20 -0
  10. package/packages/config-eslint/dictionaries/index.js +2 -1
  11. package/packages/config-eslint/index.js +14 -3
  12. package/packages/config-eslint/package.json +25 -25
  13. package/packages/config-eslint/plugins/typescript/index.js +1 -1
  14. package/packages/config-eslint/plugins/unicorn.js +2 -0
  15. package/packages/config-eslint/plugins/vue.js +34 -2
  16. package/packages/config-hooks/LICENSE +20 -0
  17. package/packages/config-hooks/README.md +18 -12
  18. package/packages/config-hooks/index.js +2 -0
  19. package/packages/config-hooks/lint-staged.js +4 -4
  20. package/packages/config-hooks/package.json +6 -5
  21. package/packages/config-htmllint/LICENSE +20 -0
  22. package/packages/config-markdownlint/LICENSE +20 -0
  23. package/packages/config-markdownlint/README.md +5 -5
  24. package/packages/config-markdownlint/index.json +17 -0
  25. package/packages/config-markdownlint/package.json +5 -5
  26. package/packages/config-npmlint/LICENSE +20 -0
  27. package/packages/config-npmlint/package.json +2 -2
  28. package/packages/config-prettier/LICENSE +20 -0
  29. package/packages/config-prettier/README.md +8 -3
  30. package/packages/config-prettier/index.js +14 -10
  31. package/packages/config-prettier/package.json +16 -12
  32. package/packages/config-prettier/plugins/jsdoc.js +1 -1
  33. package/packages/config-prettier/plugins/pug.js +1 -1
  34. package/packages/config-prettier/plugins/sort-json.js +1 -1
  35. package/packages/config-prettier/plugins/svelte.js +1 -1
  36. package/packages/config-prettier/plugins/tailwindcss.js +1 -1
  37. package/packages/config-prettier/plugins/xml.js +1 -1
  38. package/packages/config-stylelint/LICENSE +20 -0
  39. package/packages/config-stylelint/README.md +5 -4
  40. package/packages/config-stylelint/index.js +22 -25
  41. package/packages/config-stylelint/package.json +22 -18
  42. package/packages/config-stylelint/plugins/a11y.js +1 -1
  43. package/packages/config-stylelint/plugins/at-rule-no-children.js +1 -1
  44. package/packages/config-stylelint/plugins/color-format.js +1 -1
  45. package/packages/config-stylelint/plugins/declaration-block-no-ignored-properties.js +1 -1
  46. package/packages/config-stylelint/plugins/high-performance-animation.js +1 -1
  47. package/packages/config-stylelint/plugins/no-nested-media.js +1 -1
  48. package/packages/config-stylelint/plugins/no-unresolved-module.js +1 -1
  49. package/packages/config-stylelint/plugins/no-unsupported-browser-features.js +1 -1
  50. package/packages/config-stylelint/plugins/optional/gamut.js +1 -1
  51. package/packages/config-stylelint/plugins/optional/logical-css.js +1 -1
  52. package/packages/config-stylelint/plugins/optional/no-indistinguishable-colors.js +1 -1
  53. package/packages/config-stylelint/plugins/order.js +1 -1
  54. package/packages/config-stylelint/plugins/prettier.js +1 -1
  55. package/packages/config-stylelint/plugins/scss.js +1 -1
  56. package/packages/config-stylelint/plugins/selector-no-empty.js +1 -1
  57. package/packages/config-stylelint/plugins/use-nesting.js +1 -1
  58. package/packages/config-stylelint/plugins/vue.js +1 -1
  59. package/prettier.config.js +5 -0
  60. package/scripts/lint.eslint.sh +1 -1
  61. package/scripts/lint.markdownlint.sh +1 -1
  62. package/stylelint.config.js +14 -0
  63. package/.eslintrc.js +0 -3
  64. package/.huskyrc.js +0 -3
  65. package/.linthtmlrc.js +0 -3
  66. package/.lintstagedrc.js +0 -3
  67. package/.markdownlintrc.js +0 -3
  68. package/.prettierrc.js +0 -3
  69. package/.stylelintrc.js +0 -4
  70. package/packages/config-hooks/husky.js +0 -6
  71. package/packages/config-markdownlint/index.js +0 -17
  72. package/packages/config-markdownlint/node_modules/markdown-it/LICENSE +0 -22
  73. package/packages/config-markdownlint/node_modules/markdown-it/README.md +0 -309
  74. package/packages/config-markdownlint/node_modules/markdown-it/bin/markdown-it.js +0 -117
  75. package/packages/config-markdownlint/node_modules/markdown-it/dist/markdown-it.js +0 -8441
  76. package/packages/config-markdownlint/node_modules/markdown-it/dist/markdown-it.min.js +0 -3
  77. package/packages/config-markdownlint/node_modules/markdown-it/index.js +0 -4
  78. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/entities.js +0 -6
  79. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/html_blocks.js +0 -70
  80. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/html_re.js +0 -28
  81. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/utils.js +0 -317
  82. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/index.js +0 -7
  83. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_destination.js +0 -80
  84. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_label.js +0 -48
  85. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_title.js +0 -55
  86. package/packages/config-markdownlint/node_modules/markdown-it/lib/index.js +0 -582
  87. package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_block.js +0 -131
  88. package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_core.js +0 -61
  89. package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_inline.js +0 -192
  90. package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/commonmark.js +0 -81
  91. package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/default.js +0 -41
  92. package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/zero.js +0 -63
  93. package/packages/config-markdownlint/node_modules/markdown-it/lib/renderer.js +0 -341
  94. package/packages/config-markdownlint/node_modules/markdown-it/lib/ruler.js +0 -352
  95. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/blockquote.js +0 -226
  96. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/code.js +0 -34
  97. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/fence.js +0 -98
  98. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/heading.js +0 -55
  99. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/hr.js +0 -45
  100. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/html_block.js +0 -74
  101. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/lheading.js +0 -83
  102. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/list.js +0 -362
  103. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/paragraph.js +0 -51
  104. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/reference.js +0 -198
  105. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/state_block.js +0 -231
  106. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/table.js +0 -221
  107. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/block.js +0 -16
  108. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/inline.js +0 -13
  109. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/linkify.js +0 -142
  110. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/normalize.js +0 -21
  111. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/replacements.js +0 -105
  112. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/smartquotes.js +0 -201
  113. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/state_core.js +0 -20
  114. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/text_join.js +0 -45
  115. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/autolink.js +0 -76
  116. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/backticks.js +0 -63
  117. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/balance_pairs.js +0 -130
  118. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/emphasis.js +0 -130
  119. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/entity.js +0 -55
  120. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/escape.js +0 -71
  121. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/fragments_join.js +0 -41
  122. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/html_inline.js +0 -58
  123. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/image.js +0 -152
  124. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/link.js +0 -150
  125. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/linkify.js +0 -62
  126. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/newline.js +0 -46
  127. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/state_inline.js +0 -158
  128. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/strikethrough.js +0 -130
  129. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/text.js +0 -89
  130. package/packages/config-markdownlint/node_modules/markdown-it/lib/token.js +0 -201
  131. package/packages/config-markdownlint/node_modules/markdown-it/package.json +0 -87
  132. package/packages/config-markdownlint/node_modules/markdownlint/CHANGELOG.md +0 -428
  133. package/packages/config-markdownlint/node_modules/markdownlint/CONTRIBUTING.md +0 -92
  134. package/packages/config-markdownlint/node_modules/markdownlint/LICENSE +0 -21
  135. package/packages/config-markdownlint/node_modules/markdownlint/README.md +0 -1026
  136. package/packages/config-markdownlint/node_modules/markdownlint/demo/markdownlint-browser.js +0 -6814
  137. package/packages/config-markdownlint/node_modules/markdownlint/doc/CustomRules.md +0 -376
  138. package/packages/config-markdownlint/node_modules/markdownlint/doc/Prettier.md +0 -27
  139. package/packages/config-markdownlint/node_modules/markdownlint/doc/ReleaseProcess.md +0 -20
  140. package/packages/config-markdownlint/node_modules/markdownlint/doc/Rules.md +0 -2335
  141. package/packages/config-markdownlint/node_modules/markdownlint/doc/md001.md +0 -37
  142. package/packages/config-markdownlint/node_modules/markdownlint/doc/md003.md +0 -59
  143. package/packages/config-markdownlint/node_modules/markdownlint/doc/md004.md +0 -49
  144. package/packages/config-markdownlint/node_modules/markdownlint/doc/md005.md +0 -53
  145. package/packages/config-markdownlint/node_modules/markdownlint/doc/md007.md +0 -52
  146. package/packages/config-markdownlint/node_modules/markdownlint/doc/md009.md +0 -51
  147. package/packages/config-markdownlint/node_modules/markdownlint/doc/md010.md +0 -56
  148. package/packages/config-markdownlint/node_modules/markdownlint/doc/md011.md +0 -30
  149. package/packages/config-markdownlint/node_modules/markdownlint/doc/md012.md +0 -38
  150. package/packages/config-markdownlint/node_modules/markdownlint/doc/md013.md +0 -57
  151. package/packages/config-markdownlint/node_modules/markdownlint/doc/md014.md +0 -54
  152. package/packages/config-markdownlint/node_modules/markdownlint/doc/md018.md +0 -27
  153. package/packages/config-markdownlint/node_modules/markdownlint/doc/md019.md +0 -28
  154. package/packages/config-markdownlint/node_modules/markdownlint/doc/md020.md +0 -29
  155. package/packages/config-markdownlint/node_modules/markdownlint/doc/md021.md +0 -31
  156. package/packages/config-markdownlint/node_modules/markdownlint/doc/md022.md +0 -52
  157. package/packages/config-markdownlint/node_modules/markdownlint/doc/md023.md +0 -33
  158. package/packages/config-markdownlint/node_modules/markdownlint/doc/md024.md +0 -47
  159. package/packages/config-markdownlint/node_modules/markdownlint/doc/md025.md +0 -49
  160. package/packages/config-markdownlint/node_modules/markdownlint/doc/md026.md +0 -40
  161. package/packages/config-markdownlint/node_modules/markdownlint/doc/md027.md +0 -24
  162. package/packages/config-markdownlint/node_modules/markdownlint/doc/md028.md +0 -40
  163. package/packages/config-markdownlint/node_modules/markdownlint/doc/md029.md +0 -98
  164. package/packages/config-markdownlint/node_modules/markdownlint/doc/md030.md +0 -82
  165. package/packages/config-markdownlint/node_modules/markdownlint/doc/md031.md +0 -50
  166. package/packages/config-markdownlint/node_modules/markdownlint/doc/md032.md +0 -55
  167. package/packages/config-markdownlint/node_modules/markdownlint/doc/md033.md +0 -27
  168. package/packages/config-markdownlint/node_modules/markdownlint/doc/md034.md +0 -50
  169. package/packages/config-markdownlint/node_modules/markdownlint/doc/md035.md +0 -42
  170. package/packages/config-markdownlint/node_modules/markdownlint/doc/md036.md +0 -45
  171. package/packages/config-markdownlint/node_modules/markdownlint/doc/md037.md +0 -37
  172. package/packages/config-markdownlint/node_modules/markdownlint/doc/md038.md +0 -40
  173. package/packages/config-markdownlint/node_modules/markdownlint/doc/md039.md +0 -21
  174. package/packages/config-markdownlint/node_modules/markdownlint/doc/md040.md +0 -52
  175. package/packages/config-markdownlint/node_modules/markdownlint/doc/md041.md +0 -49
  176. package/packages/config-markdownlint/node_modules/markdownlint/doc/md042.md +0 -32
  177. package/packages/config-markdownlint/node_modules/markdownlint/doc/md043.md +0 -69
  178. package/packages/config-markdownlint/node_modules/markdownlint/doc/md044.md +0 -35
  179. package/packages/config-markdownlint/node_modules/markdownlint/doc/md045.md +0 -40
  180. package/packages/config-markdownlint/node_modules/markdownlint/doc/md046.md +0 -40
  181. package/packages/config-markdownlint/node_modules/markdownlint/doc/md047.md +0 -34
  182. package/packages/config-markdownlint/node_modules/markdownlint/doc/md048.md +0 -41
  183. package/packages/config-markdownlint/node_modules/markdownlint/doc/md049.md +0 -32
  184. package/packages/config-markdownlint/node_modules/markdownlint/doc/md050.md +0 -32
  185. package/packages/config-markdownlint/node_modules/markdownlint/doc/md051.md +0 -61
  186. package/packages/config-markdownlint/node_modules/markdownlint/doc/md052.md +0 -40
  187. package/packages/config-markdownlint/node_modules/markdownlint/doc/md053.md +0 -38
  188. package/packages/config-markdownlint/node_modules/markdownlint/doc/md054.md +0 -100
  189. package/packages/config-markdownlint/node_modules/markdownlint/helpers/LICENSE +0 -21
  190. package/packages/config-markdownlint/node_modules/markdownlint/helpers/README.md +0 -70
  191. package/packages/config-markdownlint/node_modules/markdownlint/helpers/helpers.js +0 -1025
  192. package/packages/config-markdownlint/node_modules/markdownlint/helpers/micromark.cjs +0 -426
  193. package/packages/config-markdownlint/node_modules/markdownlint/helpers/package.json +0 -26
  194. package/packages/config-markdownlint/node_modules/markdownlint/helpers/shared.js +0 -10
  195. package/packages/config-markdownlint/node_modules/markdownlint/lib/cache.js +0 -21
  196. package/packages/config-markdownlint/node_modules/markdownlint/lib/configuration.d.ts +0 -1152
  197. package/packages/config-markdownlint/node_modules/markdownlint/lib/constants.js +0 -14
  198. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.d.ts +0 -406
  199. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.js +0 -1476
  200. package/packages/config-markdownlint/node_modules/markdownlint/lib/md001.js +0 -22
  201. package/packages/config-markdownlint/node_modules/markdownlint/lib/md003.js +0 -42
  202. package/packages/config-markdownlint/node_modules/markdownlint/lib/md004.js +0 -76
  203. package/packages/config-markdownlint/node_modules/markdownlint/lib/md005.js +0 -73
  204. package/packages/config-markdownlint/node_modules/markdownlint/lib/md007.js +0 -86
  205. package/packages/config-markdownlint/node_modules/markdownlint/lib/md009.js +0 -86
  206. package/packages/config-markdownlint/node_modules/markdownlint/lib/md010.js +0 -60
  207. package/packages/config-markdownlint/node_modules/markdownlint/lib/md011.js +0 -46
  208. package/packages/config-markdownlint/node_modules/markdownlint/lib/md012.js +0 -32
  209. package/packages/config-markdownlint/node_modules/markdownlint/lib/md013.js +0 -96
  210. package/packages/config-markdownlint/node_modules/markdownlint/lib/md014.js +0 -53
  211. package/packages/config-markdownlint/node_modules/markdownlint/lib/md018.js +0 -34
  212. package/packages/config-markdownlint/node_modules/markdownlint/lib/md019.js +0 -39
  213. package/packages/config-markdownlint/node_modules/markdownlint/lib/md020.js +0 -62
  214. package/packages/config-markdownlint/node_modules/markdownlint/lib/md021.js +0 -62
  215. package/packages/config-markdownlint/node_modules/markdownlint/lib/md022.js +0 -108
  216. package/packages/config-markdownlint/node_modules/markdownlint/lib/md023.js +0 -38
  217. package/packages/config-markdownlint/node_modules/markdownlint/lib/md024.js +0 -38
  218. package/packages/config-markdownlint/node_modules/markdownlint/lib/md025.js +0 -32
  219. package/packages/config-markdownlint/node_modules/markdownlint/lib/md026.js +0 -50
  220. package/packages/config-markdownlint/node_modules/markdownlint/lib/md027.js +0 -56
  221. package/packages/config-markdownlint/node_modules/markdownlint/lib/md028.js +0 -30
  222. package/packages/config-markdownlint/node_modules/markdownlint/lib/md029.js +0 -67
  223. package/packages/config-markdownlint/node_modules/markdownlint/lib/md030.js +0 -61
  224. package/packages/config-markdownlint/node_modules/markdownlint/lib/md031.js +0 -40
  225. package/packages/config-markdownlint/node_modules/markdownlint/lib/md032.js +0 -78
  226. package/packages/config-markdownlint/node_modules/markdownlint/lib/md033.js +0 -39
  227. package/packages/config-markdownlint/node_modules/markdownlint/lib/md034.js +0 -79
  228. package/packages/config-markdownlint/node_modules/markdownlint/lib/md035.js +0 -24
  229. package/packages/config-markdownlint/node_modules/markdownlint/lib/md036.js +0 -56
  230. package/packages/config-markdownlint/node_modules/markdownlint/lib/md037.js +0 -91
  231. package/packages/config-markdownlint/node_modules/markdownlint/lib/md038.js +0 -97
  232. package/packages/config-markdownlint/node_modules/markdownlint/lib/md039.js +0 -67
  233. package/packages/config-markdownlint/node_modules/markdownlint/lib/md040.js +0 -37
  234. package/packages/config-markdownlint/node_modules/markdownlint/lib/md041.js +0 -42
  235. package/packages/config-markdownlint/node_modules/markdownlint/lib/md042.js +0 -49
  236. package/packages/config-markdownlint/node_modules/markdownlint/lib/md043.js +0 -64
  237. package/packages/config-markdownlint/node_modules/markdownlint/lib/md044.js +0 -107
  238. package/packages/config-markdownlint/node_modules/markdownlint/lib/md045.js +0 -60
  239. package/packages/config-markdownlint/node_modules/markdownlint/lib/md046.js +0 -33
  240. package/packages/config-markdownlint/node_modules/markdownlint/lib/md047.js +0 -28
  241. package/packages/config-markdownlint/node_modules/markdownlint/lib/md048.js +0 -30
  242. package/packages/config-markdownlint/node_modules/markdownlint/lib/md049-md050.js +0 -89
  243. package/packages/config-markdownlint/node_modules/markdownlint/lib/md051.js +0 -172
  244. package/packages/config-markdownlint/node_modules/markdownlint/lib/md052.js +0 -39
  245. package/packages/config-markdownlint/node_modules/markdownlint/lib/md053.js +0 -59
  246. package/packages/config-markdownlint/node_modules/markdownlint/lib/md054.js +0 -125
  247. package/packages/config-markdownlint/node_modules/markdownlint/lib/rules.js +0 -65
  248. package/packages/config-markdownlint/node_modules/markdownlint/package.json +0 -109
  249. package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.jsonc +0 -297
  250. package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.yaml +0 -266
  251. package/packages/config-markdownlint/node_modules/markdownlint/schema/markdownlint-config-schema.json +0 -1762
  252. package/packages/config-markdownlint/node_modules/markdownlint/style/all.json +0 -5
  253. package/packages/config-markdownlint/node_modules/markdownlint/style/cirosantilli.json +0 -22
  254. package/packages/config-markdownlint/node_modules/markdownlint/style/prettier.json +0 -26
  255. package/packages/config-markdownlint/node_modules/markdownlint/style/relaxed.json +0 -12
  256. /package/packages/config-eslint/plugins/{security.js → optional/security.js} +0 -0
@@ -1,2335 +0,0 @@
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
- This rule is triggered when you skip heading levels in a Markdown document, for
16
- example:
17
-
18
- ```markdown
19
- # Heading 1
20
-
21
- ### Heading 3
22
-
23
- We skipped out a 2nd level heading in this document
24
- ```
25
-
26
- When using multiple heading levels, nested headings should increase by only one
27
- level at a time:
28
-
29
- ```markdown
30
- # Heading 1
31
-
32
- ## Heading 2
33
-
34
- ### Heading 3
35
-
36
- #### Heading 4
37
-
38
- ## Another Heading 2
39
-
40
- ### Another Heading 3
41
- ```
42
-
43
- Rationale: Headings represent the structure of a document and can be confusing
44
- when skipped - especially for accessibility scenarios. More information:
45
- <https://www.w3.org/WAI/tutorials/page-structure/headings/>.
46
-
47
- <a name="md003"></a>
48
-
49
- ## `MD003` - Heading style
50
-
51
- Tags: `headings`
52
-
53
- Aliases: `heading-style`
54
-
55
- Parameters:
56
-
57
- - `style`: Heading style (`string`, default `consistent`, values `atx` /
58
- `atx_closed` / `consistent` / `setext` / `setext_with_atx` /
59
- `setext_with_atx_closed`)
60
-
61
- This rule is triggered when different heading styles are used in the same
62
- document:
63
-
64
- ```markdown
65
- # ATX style H1
66
-
67
- ## Closed ATX style H2 ##
68
-
69
- Setext style H1
70
- ===============
71
- ```
72
-
73
- To fix the issue, use consistent heading styles throughout the document:
74
-
75
- ```markdown
76
- # ATX style H1
77
-
78
- ## ATX style H2
79
- ```
80
-
81
- The `setext_with_atx` and `setext_with_atx_closed` settings allow ATX-style
82
- headings of level 3 or more in documents with setext-style headings (which only
83
- support level 1 and 2 headings):
84
-
85
- ```markdown
86
- Setext style H1
87
- ===============
88
-
89
- Setext style H2
90
- ---------------
91
-
92
- ### ATX style H3
93
- ```
94
-
95
- Note: The configured heading style can be a specific style to require (`atx`,
96
- `atx_closed`, `setext`, `setext_with_atx`, `setext_with_atx_closed`), or may
97
- just require that usage is consistent within the document via `consistent`.
98
-
99
- Note: The placement of a horizontal rule directly below a line of text can
100
- trigger this rule by turning that text into a level 2 setext-style heading:
101
-
102
- ```markdown
103
- A line of text followed by a horizontal rule becomes a heading
104
- ---
105
- ```
106
-
107
- Rationale: Consistent formatting makes it easier to understand a document.
108
-
109
- <a name="md004"></a>
110
-
111
- ## `MD004` - Unordered list style
112
-
113
- Tags: `bullet`, `ul`
114
-
115
- Aliases: `ul-style`
116
-
117
- Parameters:
118
-
119
- - `style`: List style (`string`, default `consistent`, values `asterisk` /
120
- `consistent` / `dash` / `plus` / `sublist`)
121
-
122
- Fixable: Some violations can be fixed by tooling
123
-
124
- This rule is triggered when the symbols used in the document for unordered
125
- list items do not match the configured unordered list style:
126
-
127
- ```markdown
128
- * Item 1
129
- + Item 2
130
- - Item 3
131
- ```
132
-
133
- To fix this issue, use the configured style for list items throughout the
134
- document:
135
-
136
- ```markdown
137
- * Item 1
138
- * Item 2
139
- * Item 3
140
- ```
141
-
142
- The configured list style can be a specific symbol to use (asterisk, plus,
143
- dash), to ensure that all list styling is consistent, or to ensure that each
144
- sublist has a consistent symbol that differs from its parent list.
145
-
146
- For example, the following is valid for the `sublist` style because the
147
- outer-most indent uses asterisk, the middle indent uses plus, and the inner-most
148
- indent uses dash:
149
-
150
- ```markdown
151
- * Item 1
152
- + Item 2
153
- - Item 3
154
- + Item 4
155
- * Item 4
156
- + Item 5
157
- ```
158
-
159
- Rationale: Consistent formatting makes it easier to understand a document.
160
-
161
- <a name="md005"></a>
162
-
163
- ## `MD005` - Inconsistent indentation for list items at the same level
164
-
165
- Tags: `bullet`, `indentation`, `ul`
166
-
167
- Aliases: `list-indent`
168
-
169
- Fixable: Some violations can be fixed by tooling
170
-
171
- This rule is triggered when list items are parsed as being at the same level,
172
- but don't have the same indentation:
173
-
174
- ```markdown
175
- * Item 1
176
- * Nested Item 1
177
- * Nested Item 2
178
- * A misaligned item
179
- ```
180
-
181
- Usually, this rule will be triggered because of a typo. Correct the indentation
182
- for the list to fix it:
183
-
184
- ```markdown
185
- * Item 1
186
- * Nested Item 1
187
- * Nested Item 2
188
- * Nested Item 3
189
- ```
190
-
191
- Sequentially-ordered list markers are usually left-aligned such that all items
192
- have the same starting column:
193
-
194
- ```markdown
195
- ...
196
- 8. Item
197
- 9. Item
198
- 10. Item
199
- 11. Item
200
- ...
201
- ```
202
-
203
- This rule also supports right-alignment of list markers such that all items have
204
- the same ending column:
205
-
206
- ```markdown
207
- ...
208
- 8. Item
209
- 9. Item
210
- 10. Item
211
- 11. Item
212
- ...
213
- ```
214
-
215
- Rationale: Violations of this rule can lead to improperly rendered content.
216
-
217
- <a name="md007"></a>
218
-
219
- ## `MD007` - Unordered list indentation
220
-
221
- Tags: `bullet`, `indentation`, `ul`
222
-
223
- Aliases: `ul-indent`
224
-
225
- Parameters:
226
-
227
- - `indent`: Spaces for indent (`integer`, default `2`)
228
- - `start_indent`: Spaces for first level indent (when start_indented is set)
229
- (`integer`, default `2`)
230
- - `start_indented`: Whether to indent the first level of the list (`boolean`,
231
- default `false`)
232
-
233
- Fixable: Some violations can be fixed by tooling
234
-
235
- This rule is triggered when list items are not indented by the configured
236
- number of spaces (default: 2).
237
-
238
- Example:
239
-
240
- ```markdown
241
- * List item
242
- * Nested list item indented by 3 spaces
243
- ```
244
-
245
- Corrected Example:
246
-
247
- ```markdown
248
- * List item
249
- * Nested list item indented by 2 spaces
250
- ```
251
-
252
- Note: This rule applies to a sublist only if its parent lists are all also
253
- unordered (otherwise, extra indentation of ordered lists interferes with the
254
- rule).
255
-
256
- The `start_indented` parameter allows the first level of lists to be indented by
257
- the configured number of spaces rather than starting at zero. The `start_indent`
258
- parameter allows the first level of lists to be indented by a different number
259
- of spaces than the rest (ignored when `start_indented` is not set).
260
-
261
- Rationale: Indenting by 2 spaces allows the content of a nested list to be in
262
- line with the start of the content of the parent list when a single space is
263
- used after the list marker. Indenting by 4 spaces is consistent with code blocks
264
- and simpler for editors to implement. Additionally, this can be a compatibility
265
- issue for other Markdown parsers, which require 4-space indents. More
266
- information: [Markdown Style Guide][markdown-style-guide].
267
-
268
- Note: See [Prettier.md](Prettier.md) for compatibility information.
269
-
270
- [markdown-style-guide]: https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists
271
-
272
- <a name="md009"></a>
273
-
274
- ## `MD009` - Trailing spaces
275
-
276
- Tags: `whitespace`
277
-
278
- Aliases: `no-trailing-spaces`
279
-
280
- Parameters:
281
-
282
- - `br_spaces`: Spaces for line break (`integer`, default `2`)
283
- - `list_item_empty_lines`: Allow spaces for empty lines in list items
284
- (`boolean`, default `false`)
285
- - `strict`: Include unnecessary breaks (`boolean`, default `false`)
286
-
287
- Fixable: Some violations can be fixed by tooling
288
-
289
- This rule is triggered on any lines that end with unexpected whitespace. To fix
290
- this, remove the trailing space from the end of the line.
291
-
292
- Note: Trailing space is allowed in indented and fenced code blocks because some
293
- languages require it.
294
-
295
- The `br_spaces` parameter allows an exception to this rule for a specific number
296
- of trailing spaces, typically used to insert an explicit line break. The default
297
- value allows 2 spaces to indicate a hard break (\<br> element).
298
-
299
- Note: You must set `br_spaces` to a value >= 2 for this parameter to take
300
- effect. Setting `br_spaces` to 1 behaves the same as 0, disallowing any trailing
301
- spaces.
302
-
303
- By default, this rule will not trigger when the allowed number of spaces is
304
- used, even when it doesn't create a hard break (for example, at the end of a
305
- paragraph). To report such instances as well, set the `strict` parameter to
306
- `true`.
307
-
308
- ```markdown
309
- Text text text
310
- text[2 spaces]
311
- ```
312
-
313
- Using spaces to indent blank lines inside a list item is usually not necessary,
314
- but some parsers require it. Set the `list_item_empty_lines` parameter to `true`
315
- to allow this (even when `strict` is `true`):
316
-
317
- ```markdown
318
- - list item text
319
- [2 spaces]
320
- list item text
321
- ```
322
-
323
- Rationale: Except when being used to create a line break, trailing whitespace
324
- has no purpose and does not affect the rendering of content.
325
-
326
- <a name="md010"></a>
327
-
328
- ## `MD010` - Hard tabs
329
-
330
- Tags: `hard_tab`, `whitespace`
331
-
332
- Aliases: `no-hard-tabs`
333
-
334
- Parameters:
335
-
336
- - `code_blocks`: Include code blocks (`boolean`, default `true`)
337
- - `ignore_code_languages`: Fenced code languages to ignore (`string[]`, default
338
- `[]`)
339
- - `spaces_per_tab`: Number of spaces for each hard tab (`integer`, default `1`)
340
-
341
- Fixable: Some violations can be fixed by tooling
342
-
343
- This rule is triggered by any lines that contain hard tab characters instead
344
- of using spaces for indentation. To fix this, replace any hard tab characters
345
- with spaces instead.
346
-
347
- Example:
348
-
349
- <!-- markdownlint-disable no-hard-tabs -->
350
-
351
- ```markdown
352
- Some text
353
-
354
- * hard tab character used to indent the list item
355
- ```
356
-
357
- <!-- markdownlint-restore -->
358
-
359
- Corrected example:
360
-
361
- ```markdown
362
- Some text
363
-
364
- * Spaces used to indent the list item instead
365
- ```
366
-
367
- You have the option to exclude this rule for code blocks and spans. To do so,
368
- set the `code_blocks` parameter to `false`. Code blocks and spans are included
369
- by default since handling of tabs by Markdown tools can be inconsistent (e.g.,
370
- using 4 vs. 8 spaces).
371
-
372
- When code blocks are scanned (e.g., by default or if `code_blocks` is `true`),
373
- the `ignore_code_languages` parameter can be set to a list of languages that
374
- should be ignored (i.e., hard tabs will be allowed, though not required). This
375
- makes it easier for documents to include code for languages that require hard
376
- tabs.
377
-
378
- By default, violations of this rule are fixed by replacing the tab with 1 space
379
- character. To use a different number of spaces, set the `spaces_per_tab`
380
- parameter to the desired value.
381
-
382
- Rationale: Hard tabs are often rendered inconsistently by different editors and
383
- can be harder to work with than spaces.
384
-
385
- <a name="md011"></a>
386
-
387
- ## `MD011` - Reversed link syntax
388
-
389
- Tags: `links`
390
-
391
- Aliases: `no-reversed-links`
392
-
393
- Fixable: Some violations can be fixed by tooling
394
-
395
- This rule is triggered when text that appears to be a link is encountered, but
396
- where the syntax appears to have been reversed (the `[]` and `()` are
397
- reversed):
398
-
399
- ```markdown
400
- (Incorrect link syntax)[https://www.example.com/]
401
- ```
402
-
403
- To fix this, swap the `[]` and `()` around:
404
-
405
- ```markdown
406
- [Correct link syntax](https://www.example.com/)
407
- ```
408
-
409
- Note: [Markdown Extra](https://en.wikipedia.org/wiki/Markdown_Extra)-style
410
- footnotes do not trigger this rule:
411
-
412
- ```markdown
413
- For (example)[^1]
414
- ```
415
-
416
- Rationale: Reversed links are not rendered as usable links.
417
-
418
- <a name="md012"></a>
419
-
420
- ## `MD012` - Multiple consecutive blank lines
421
-
422
- Tags: `blank_lines`, `whitespace`
423
-
424
- Aliases: `no-multiple-blanks`
425
-
426
- Parameters:
427
-
428
- - `maximum`: Consecutive blank lines (`integer`, default `1`)
429
-
430
- Fixable: Some violations can be fixed by tooling
431
-
432
- This rule is triggered when there are multiple consecutive blank lines in the
433
- document:
434
-
435
- ```markdown
436
- Some text here
437
-
438
-
439
- Some more text here
440
- ```
441
-
442
- To fix this, delete the offending lines:
443
-
444
- ```markdown
445
- Some text here
446
-
447
- Some more text here
448
- ```
449
-
450
- Note: this rule will not be triggered if there are multiple consecutive blank
451
- lines inside code blocks.
452
-
453
- Note: The `maximum` parameter can be used to configure the maximum number of
454
- consecutive blank lines.
455
-
456
- Rationale: Except in a code block, blank lines serve no purpose and do not
457
- affect the rendering of content.
458
-
459
- <a name="md013"></a>
460
-
461
- ## `MD013` - Line length
462
-
463
- Tags: `line_length`
464
-
465
- Aliases: `line-length`
466
-
467
- Parameters:
468
-
469
- - `code_block_line_length`: Number of characters for code blocks (`integer`,
470
- default `80`)
471
- - `code_blocks`: Include code blocks (`boolean`, default `true`)
472
- - `heading_line_length`: Number of characters for headings (`integer`, default
473
- `80`)
474
- - `headings`: Include headings (`boolean`, default `true`)
475
- - `line_length`: Number of characters (`integer`, default `80`)
476
- - `stern`: Stern length checking (`boolean`, default `false`)
477
- - `strict`: Strict length checking (`boolean`, default `false`)
478
- - `tables`: Include tables (`boolean`, default `true`)
479
-
480
- This rule is triggered when there are lines that are longer than the
481
- configured `line_length` (default: 80 characters). To fix this, split the line
482
- up into multiple lines. To set a different maximum length for headings, use
483
- `heading_line_length`. To set a different maximum length for code blocks, use
484
- `code_block_line_length`
485
-
486
- This rule has an exception when there is no whitespace beyond the configured
487
- line length. This allows you to include items such as long URLs without being
488
- forced to break them in the middle. To disable this exception, set the `strict`
489
- parameter to `true` and an issue will be reported when any line is too long. To
490
- warn for lines that are too long and could be fixed but allow long lines
491
- without spaces, set the `stern` parameter to `true`.
492
-
493
- For example (assuming normal behavior):
494
-
495
- ```markdown
496
- IF THIS LINE IS THE MAXIMUM LENGTH
497
- This line is okay because there are-no-spaces-beyond-that-length
498
- And this line is a violation because there are
499
- This-line-is-also-okay-because-there-are-no-spaces
500
- ```
501
-
502
- In `strict` or `stern` modes, the two middle lines above are a violation. The
503
- third line is a violation in `strict` mode but allowed in `stern` mode.
504
-
505
- You have the option to exclude this rule for code blocks, tables, or headings.
506
- To do so, set the `code_blocks`, `tables`, or `headings` parameter(s) to false.
507
-
508
- Code blocks are included in this rule by default since it is often a
509
- requirement for document readability, and tentatively compatible with code
510
- rules. Still, some languages do not lend themselves to short lines.
511
-
512
- Lines with link/image reference definitions are always exempted from this rule
513
- (even in `strict` mode) because there is generally no way to split such lines
514
- without breaking the URL.
515
-
516
- Rationale: Extremely long lines can be difficult to work with in some editors.
517
- More information: <https://cirosantilli.com/markdown-style-guide#line-wrapping>.
518
-
519
- <a name="md014"></a>
520
-
521
- ## `MD014` - Dollar signs used before commands without showing output
522
-
523
- Tags: `code`
524
-
525
- Aliases: `commands-show-output`
526
-
527
- Fixable: Some violations can be fixed by tooling
528
-
529
- This rule is triggered when there are code blocks showing shell commands to be
530
- typed, and *all* of the shell commands are preceded by dollar signs ($):
531
-
532
- <!-- markdownlint-disable commands-show-output -->
533
-
534
- ```markdown
535
- $ ls
536
- $ cat foo
537
- $ less bar
538
- ```
539
-
540
- <!-- markdownlint-restore -->
541
-
542
- The dollar signs are unnecessary in this situation, and should not be
543
- included:
544
-
545
- ```markdown
546
- ls
547
- cat foo
548
- less bar
549
- ```
550
-
551
- Showing output for commands preceded by dollar signs does not trigger this rule:
552
-
553
- ```markdown
554
- $ ls
555
- foo bar
556
- $ cat foo
557
- Hello world
558
- $ cat bar
559
- baz
560
- ```
561
-
562
- Because some commands do not produce output, it is not a violation if *some*
563
- commands do not have output:
564
-
565
- ```markdown
566
- $ mkdir test
567
- mkdir: created directory 'test'
568
- $ ls test
569
- ```
570
-
571
- Rationale: It is easier to copy/paste and less noisy if the dollar signs
572
- are omitted when they are not needed. See
573
- <https://cirosantilli.com/markdown-style-guide#dollar-signs-in-shell-code>
574
- for more information.
575
-
576
- <a name="md018"></a>
577
-
578
- ## `MD018` - No space after hash on atx style heading
579
-
580
- Tags: `atx`, `headings`, `spaces`
581
-
582
- Aliases: `no-missing-space-atx`
583
-
584
- Fixable: Some violations can be fixed by tooling
585
-
586
- This rule is triggered when spaces are missing after the hash characters
587
- in an atx style heading:
588
-
589
- ```markdown
590
- #Heading 1
591
-
592
- ##Heading 2
593
- ```
594
-
595
- To fix this, separate the heading text from the hash character by a single
596
- space:
597
-
598
- ```markdown
599
- # Heading 1
600
-
601
- ## Heading 2
602
- ```
603
-
604
- Rationale: Violations of this rule can lead to improperly rendered content.
605
-
606
- <a name="md019"></a>
607
-
608
- ## `MD019` - Multiple spaces after hash on atx style heading
609
-
610
- Tags: `atx`, `headings`, `spaces`
611
-
612
- Aliases: `no-multiple-space-atx`
613
-
614
- Fixable: Some violations can be fixed by tooling
615
-
616
- This rule is triggered when more than one space is used to separate the
617
- heading text from the hash characters in an atx style heading:
618
-
619
- ```markdown
620
- # Heading 1
621
-
622
- ## Heading 2
623
- ```
624
-
625
- To fix this, separate the heading text from the hash character by a single
626
- space:
627
-
628
- ```markdown
629
- # Heading 1
630
-
631
- ## Heading 2
632
- ```
633
-
634
- Rationale: Extra space has no purpose and does not affect the rendering of
635
- content.
636
-
637
- <a name="md020"></a>
638
-
639
- ## `MD020` - No space inside hashes on closed atx style heading
640
-
641
- Tags: `atx_closed`, `headings`, `spaces`
642
-
643
- Aliases: `no-missing-space-closed-atx`
644
-
645
- Fixable: Some violations can be fixed by tooling
646
-
647
- This rule is triggered when spaces are missing inside the hash characters
648
- in a closed atx style heading:
649
-
650
- ```markdown
651
- #Heading 1#
652
-
653
- ##Heading 2##
654
- ```
655
-
656
- To fix this, separate the heading text from the hash character by a single
657
- space:
658
-
659
- ```markdown
660
- # Heading 1 #
661
-
662
- ## Heading 2 ##
663
- ```
664
-
665
- Note: this rule will fire if either side of the heading is missing spaces.
666
-
667
- Rationale: Violations of this rule can lead to improperly rendered content.
668
-
669
- <a name="md021"></a>
670
-
671
- ## `MD021` - Multiple spaces inside hashes on closed atx style heading
672
-
673
- Tags: `atx_closed`, `headings`, `spaces`
674
-
675
- Aliases: `no-multiple-space-closed-atx`
676
-
677
- Fixable: Some violations can be fixed by tooling
678
-
679
- This rule is triggered when more than one space is used to separate the
680
- heading text from the hash characters in a closed atx style heading:
681
-
682
- ```markdown
683
- # Heading 1 #
684
-
685
- ## Heading 2 ##
686
- ```
687
-
688
- To fix this, separate the heading text from the hash character by a single
689
- space:
690
-
691
- ```markdown
692
- # Heading 1 #
693
-
694
- ## Heading 2 ##
695
- ```
696
-
697
- Note: this rule will fire if either side of the heading contains multiple
698
- spaces.
699
-
700
- Rationale: Extra space has no purpose and does not affect the rendering of
701
- content.
702
-
703
- <a name="md022"></a>
704
-
705
- ## `MD022` - Headings should be surrounded by blank lines
706
-
707
- Tags: `blank_lines`, `headings`
708
-
709
- Aliases: `blanks-around-headings`
710
-
711
- Parameters:
712
-
713
- - `lines_above`: Blank lines above heading (`integer|integer[]`, default `1`)
714
- - `lines_below`: Blank lines below heading (`integer|integer[]`, default `1`)
715
-
716
- Fixable: Some violations can be fixed by tooling
717
-
718
- This rule is triggered when headings (any style) are either not preceded or not
719
- followed by at least one blank line:
720
-
721
- ```markdown
722
- # Heading 1
723
- Some text
724
-
725
- Some more text
726
- ## Heading 2
727
- ```
728
-
729
- To fix this, ensure that all headings have a blank line both before and after
730
- (except where the heading is at the beginning or end of the document):
731
-
732
- ```markdown
733
- # Heading 1
734
-
735
- Some text
736
-
737
- Some more text
738
-
739
- ## Heading 2
740
- ```
741
-
742
- The `lines_above` and `lines_below` parameters can be used to specify a
743
- different number of blank lines (including `0`) above or below each heading.
744
- If the value `-1` is used for either parameter, any number of blank lines is
745
- allowed. To customize the number of lines above or below each heading level
746
- individually, specify a `number[]` where values correspond to heading levels
747
- 1-6 (in order).
748
-
749
- Notes: If `lines_above` or `lines_below` are configured to require more than one
750
- blank line, [MD012/no-multiple-blanks](md012.md) should also be customized. This
751
- rule checks for *at least* as many blank lines as specified; any extra blank
752
- lines are ignored.
753
-
754
- Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`,
755
- will not parse headings that don't have a blank line before, and will parse them
756
- as regular text.
757
-
758
- <a name="md023"></a>
759
-
760
- ## `MD023` - Headings must start at the beginning of the line
761
-
762
- Tags: `headings`, `spaces`
763
-
764
- Aliases: `heading-start-left`
765
-
766
- Fixable: Some violations can be fixed by tooling
767
-
768
- This rule is triggered when a heading is indented by one or more spaces:
769
-
770
- ```markdown
771
- Some text
772
-
773
- # Indented heading
774
- ```
775
-
776
- To fix this, ensure that all headings start at the beginning of the line:
777
-
778
- ```markdown
779
- Some text
780
-
781
- # Heading
782
- ```
783
-
784
- Note that scenarios like block quotes "indent" the start of the line, so the
785
- following is also correct:
786
-
787
- ```markdown
788
- > # Heading in Block Quote
789
- ```
790
-
791
- Rationale: Headings that don't start at the beginning of the line will not be
792
- parsed as headings, and will instead appear as regular text.
793
-
794
- <a name="md024"></a>
795
-
796
- ## `MD024` - Multiple headings with the same content
797
-
798
- Tags: `headings`
799
-
800
- Aliases: `no-duplicate-heading`
801
-
802
- Parameters:
803
-
804
- - `allow_different_nesting`: Only check sibling headings (`boolean`, default
805
- `false`)
806
- - `siblings_only`: Only check sibling headings (`boolean`, default `false`)
807
-
808
- This rule is triggered if there are multiple headings in the document that have
809
- the same text:
810
-
811
- ```markdown
812
- # Some text
813
-
814
- ## Some text
815
- ```
816
-
817
- To fix this, ensure that the content of each heading is different:
818
-
819
- ```markdown
820
- # Some text
821
-
822
- ## Some more text
823
- ```
824
-
825
- If the parameter `siblings_only` (alternatively `allow_different_nesting`) is
826
- set to `true`, heading duplication is allowed for non-sibling headings (common
827
- in changelogs):
828
-
829
- ```markdown
830
- # Change log
831
-
832
- ## 1.0.0
833
-
834
- ### Features
835
-
836
- ## 2.0.0
837
-
838
- ### Features
839
- ```
840
-
841
- Rationale: Some Markdown parsers generate anchors for headings based on the
842
- heading name; headings with the same content can cause problems with that.
843
-
844
- <a name="md025"></a>
845
-
846
- ## `MD025` - Multiple top-level headings in the same document
847
-
848
- Tags: `headings`
849
-
850
- Aliases: `single-h1`, `single-title`
851
-
852
- Parameters:
853
-
854
- - `front_matter_title`: RegExp for matching title in front matter (`string`,
855
- default `^\s*title\s*[:=]`)
856
- - `level`: Heading level (`integer`, default `1`)
857
-
858
- This rule is triggered when a top-level heading is in use (the first line of
859
- the file is an h1 heading), and more than one h1 heading is in use in the
860
- document:
861
-
862
- ```markdown
863
- # Top level heading
864
-
865
- # Another top-level heading
866
- ```
867
-
868
- To fix, structure your document so there is a single h1 heading that is
869
- the title for the document. Subsequent headings must be
870
- lower-level headings (h2, h3, etc.):
871
-
872
- ```markdown
873
- # Title
874
-
875
- ## Heading
876
-
877
- ## Another heading
878
- ```
879
-
880
- Note: The `level` parameter can be used to change the top-level (ex: to h2) in
881
- cases where an h1 is added externally.
882
-
883
- If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
884
- contains a `title` property (commonly used with blog posts), this rule treats
885
- that as a top level heading and will report a violation for any subsequent
886
- top-level headings. To use a different property name in the front matter,
887
- specify the text of a regular expression via the `front_matter_title` parameter.
888
- To disable the use of front matter by this rule, specify `""` for
889
- `front_matter_title`.
890
-
891
- Rationale: A top-level heading is an h1 on the first line of the file, and
892
- serves as the title for the document. If this convention is in use, then there
893
- can not be more than one title for the document, and the entire document should
894
- be contained within this heading.
895
-
896
- <a name="md026"></a>
897
-
898
- ## `MD026` - Trailing punctuation in heading
899
-
900
- Tags: `headings`
901
-
902
- Aliases: `no-trailing-punctuation`
903
-
904
- Parameters:
905
-
906
- - `punctuation`: Punctuation characters (`string`, default `.,;:!。,;:!`)
907
-
908
- Fixable: Some violations can be fixed by tooling
909
-
910
- This rule is triggered on any heading that has one of the specified normal or
911
- full-width punctuation characters as the last character in the line:
912
-
913
- ```markdown
914
- # This is a heading.
915
- ```
916
-
917
- To fix this, remove the trailing punctuation:
918
-
919
- ```markdown
920
- # This is a heading
921
- ```
922
-
923
- Note: The `punctuation` parameter can be used to specify what characters count
924
- as punctuation at the end of a heading. For example, you can change it to
925
- `".,;:"` to allow headings that end with an exclamation point. `?` is
926
- allowed by default because of how common it is in headings of FAQ-style
927
- documents. Setting the `punctuation` parameter to `""` allows all characters -
928
- and is equivalent to disabling the rule.
929
-
930
- Note: The trailing semicolon of [HTML entity references][html-entity-references]
931
- like `&copy;`, `&#169;`, and `&#x000A9;` is ignored by this rule.
932
-
933
- Rationale: Headings are not meant to be full sentences. More information:
934
- [Punctuation at the end of headers][end-punctuation].
935
-
936
- [end-punctuation]: https://cirosantilli.com/markdown-style-guide#punctuation-at-the-end-of-headers
937
- [html-entity-references]: https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
938
-
939
- <a name="md027"></a>
940
-
941
- ## `MD027` - Multiple spaces after blockquote symbol
942
-
943
- Tags: `blockquote`, `indentation`, `whitespace`
944
-
945
- Aliases: `no-multiple-space-blockquote`
946
-
947
- Fixable: Some violations can be fixed by tooling
948
-
949
- This rule is triggered when blockquotes have more than one space after the
950
- blockquote (`>`) symbol:
951
-
952
- ```markdown
953
- > This is a blockquote with bad indentation
954
- > there should only be one.
955
- ```
956
-
957
- To fix, remove any extraneous space:
958
-
959
- ```markdown
960
- > This is a blockquote with correct
961
- > indentation.
962
- ```
963
-
964
- Rationale: Consistent formatting makes it easier to understand a document.
965
-
966
- <a name="md028"></a>
967
-
968
- ## `MD028` - Blank line inside blockquote
969
-
970
- Tags: `blockquote`, `whitespace`
971
-
972
- Aliases: `no-blanks-blockquote`
973
-
974
- This rule is triggered when two blockquote blocks are separated by nothing
975
- except for a blank line:
976
-
977
- ```markdown
978
- > This is a blockquote
979
- > which is immediately followed by
980
-
981
- > this blockquote. Unfortunately
982
- > In some parsers, these are treated as the same blockquote.
983
- ```
984
-
985
- To fix this, ensure that any blockquotes that are right next to each other
986
- have some text in between:
987
-
988
- ```markdown
989
- > This is a blockquote.
990
-
991
- And Jimmy also said:
992
-
993
- > This too is a blockquote.
994
- ```
995
-
996
- Alternatively, if they are supposed to be the same quote, then add the
997
- blockquote symbol at the beginning of the blank line:
998
-
999
- ```markdown
1000
- > This is a blockquote.
1001
- >
1002
- > This is the same blockquote.
1003
- ```
1004
-
1005
- Rationale: Some Markdown parsers will treat two blockquotes separated by one
1006
- or more blank lines as the same blockquote, while others will treat them as
1007
- separate blockquotes.
1008
-
1009
- <a name="md029"></a>
1010
-
1011
- ## `MD029` - Ordered list item prefix
1012
-
1013
- Tags: `ol`
1014
-
1015
- Aliases: `ol-prefix`
1016
-
1017
- Parameters:
1018
-
1019
- - `style`: List style (`string`, default `one_or_ordered`, values `one` /
1020
- `one_or_ordered` / `ordered` / `zero`)
1021
-
1022
- This rule is triggered for ordered lists that do not either start with '1.' or
1023
- do not have a prefix that increases in numerical order (depending on the
1024
- configured style). The less-common pattern of using '0.' as a first prefix or
1025
- for all prefixes is also supported.
1026
-
1027
- Example valid list if the style is configured as 'one':
1028
-
1029
- ```markdown
1030
- 1. Do this.
1031
- 1. Do that.
1032
- 1. Done.
1033
- ```
1034
-
1035
- Examples of valid lists if the style is configured as 'ordered':
1036
-
1037
- ```markdown
1038
- 1. Do this.
1039
- 2. Do that.
1040
- 3. Done.
1041
- ```
1042
-
1043
- ```markdown
1044
- 0. Do this.
1045
- 1. Do that.
1046
- 2. Done.
1047
- ```
1048
-
1049
- All three examples are valid when the style is configured as 'one_or_ordered'.
1050
-
1051
- Example valid list if the style is configured as 'zero':
1052
-
1053
- ```markdown
1054
- 0. Do this.
1055
- 0. Do that.
1056
- 0. Done.
1057
- ```
1058
-
1059
- Example invalid list for all styles:
1060
-
1061
- ```markdown
1062
- 1. Do this.
1063
- 3. Done.
1064
- ```
1065
-
1066
- This rule supports 0-prefixing ordered list items for uniform indentation:
1067
-
1068
- ```markdown
1069
- ...
1070
- 08. Item
1071
- 09. Item
1072
- 10. Item
1073
- 11. Item
1074
- ...
1075
- ```
1076
-
1077
- Note: This rule will report violations for cases like the following where an
1078
- improperly-indented code block (or similar) appears between two list items and
1079
- "breaks" the list in two:
1080
-
1081
- <!-- markdownlint-disable code-fence-style -->
1082
-
1083
- ~~~markdown
1084
- 1. First list
1085
-
1086
- ```text
1087
- Code block
1088
- ```
1089
-
1090
- 1. Second list
1091
- ~~~
1092
-
1093
- The fix is to indent the code block so it becomes part of the preceding list
1094
- item as intended:
1095
-
1096
- ~~~markdown
1097
- 1. First list
1098
-
1099
- ```text
1100
- Code block
1101
- ```
1102
-
1103
- 2. Still first list
1104
- ~~~
1105
-
1106
- <!-- markdownlint-restore -->
1107
-
1108
- Rationale: Consistent formatting makes it easier to understand a document.
1109
-
1110
- <a name="md030"></a>
1111
-
1112
- ## `MD030` - Spaces after list markers
1113
-
1114
- Tags: `ol`, `ul`, `whitespace`
1115
-
1116
- Aliases: `list-marker-space`
1117
-
1118
- Parameters:
1119
-
1120
- - `ol_multi`: Spaces for multi-line ordered list items (`integer`, default `1`)
1121
- - `ol_single`: Spaces for single-line ordered list items (`integer`, default
1122
- `1`)
1123
- - `ul_multi`: Spaces for multi-line unordered list items (`integer`, default
1124
- `1`)
1125
- - `ul_single`: Spaces for single-line unordered list items (`integer`, default
1126
- `1`)
1127
-
1128
- Fixable: Some violations can be fixed by tooling
1129
-
1130
- This rule checks for the number of spaces between a list marker (e.g. '`-`',
1131
- '`*`', '`+`' or '`1.`') and the text of the list item.
1132
-
1133
- The number of spaces checked for depends on the document style in use, but the
1134
- default is 1 space after any list marker:
1135
-
1136
- ```markdown
1137
- * Foo
1138
- * Bar
1139
- * Baz
1140
-
1141
- 1. Foo
1142
- 1. Bar
1143
- 1. Baz
1144
-
1145
- 1. Foo
1146
- * Bar
1147
- 1. Baz
1148
- ```
1149
-
1150
- A document style may change the number of spaces after unordered list items
1151
- and ordered list items independently, as well as based on whether the content
1152
- of every item in the list consists of a single paragraph or multiple
1153
- paragraphs (including sub-lists and code blocks).
1154
-
1155
- For example, the style guide at
1156
- <https://cirosantilli.com/markdown-style-guide#spaces-after-list-marker>
1157
- specifies that 1 space after the list marker should be used if every item in
1158
- the list fits within a single paragraph, but to use 2 or 3 spaces (for ordered
1159
- and unordered lists respectively) if there are multiple paragraphs of content
1160
- inside the list:
1161
-
1162
- ```markdown
1163
- * Foo
1164
- * Bar
1165
- * Baz
1166
- ```
1167
-
1168
- vs.
1169
-
1170
- ```markdown
1171
- * Foo
1172
-
1173
- Second paragraph
1174
-
1175
- * Bar
1176
- ```
1177
-
1178
- or
1179
-
1180
- ```markdown
1181
- 1. Foo
1182
-
1183
- Second paragraph
1184
-
1185
- 1. Bar
1186
- ```
1187
-
1188
- To fix this, ensure the correct number of spaces are used after the list marker
1189
- for your selected document style.
1190
-
1191
- Rationale: Violations of this rule can lead to improperly rendered content.
1192
-
1193
- Note: See [Prettier.md](Prettier.md) for compatibility information.
1194
-
1195
- <a name="md031"></a>
1196
-
1197
- ## `MD031` - Fenced code blocks should be surrounded by blank lines
1198
-
1199
- Tags: `blank_lines`, `code`
1200
-
1201
- Aliases: `blanks-around-fences`
1202
-
1203
- Parameters:
1204
-
1205
- - `list_items`: Include list items (`boolean`, default `true`)
1206
-
1207
- Fixable: Some violations can be fixed by tooling
1208
-
1209
- This rule is triggered when fenced code blocks are either not preceded or not
1210
- followed by a blank line:
1211
-
1212
- ````markdown
1213
- Some text
1214
- ```
1215
- Code block
1216
- ```
1217
-
1218
- ```
1219
- Another code block
1220
- ```
1221
- Some more text
1222
- ````
1223
-
1224
- To fix this, ensure that all fenced code blocks have a blank line both before
1225
- and after (except where the block is at the beginning or end of the document):
1226
-
1227
- ````markdown
1228
- Some text
1229
-
1230
- ```
1231
- Code block
1232
- ```
1233
-
1234
- ```
1235
- Another code block
1236
- ```
1237
-
1238
- Some more text
1239
- ````
1240
-
1241
- Set the `list_items` parameter to `false` to disable this rule for list items.
1242
- Disabling this behavior for lists can be useful if it is necessary to create a
1243
- [tight](https://spec.commonmark.org/0.29/#tight) list containing a code fence.
1244
-
1245
- Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
1246
- not parse fenced code blocks that don't have blank lines before and after them.
1247
-
1248
- <a name="md032"></a>
1249
-
1250
- ## `MD032` - Lists should be surrounded by blank lines
1251
-
1252
- Tags: `blank_lines`, `bullet`, `ol`, `ul`
1253
-
1254
- Aliases: `blanks-around-lists`
1255
-
1256
- Fixable: Some violations can be fixed by tooling
1257
-
1258
- This rule is triggered when lists (of any kind) are either not preceded or not
1259
- followed by a blank line:
1260
-
1261
- ```markdown
1262
- Some text
1263
- * List item
1264
- * List item
1265
-
1266
- 1. List item
1267
- 2. List item
1268
- ***
1269
- ```
1270
-
1271
- In the first case above, text immediately precedes the unordered list. In the
1272
- second case above, a thematic break immediately follows the ordered list. To fix
1273
- violations of this rule, ensure that all lists have a blank line both before and
1274
- after (except when the list is at the very beginning or end of the document):
1275
-
1276
- ```markdown
1277
- Some text
1278
-
1279
- * List item
1280
- * List item
1281
-
1282
- 1. List item
1283
- 2. List item
1284
-
1285
- ***
1286
- ```
1287
-
1288
- Note that the following case is **not** a violation of this rule:
1289
-
1290
- ```markdown
1291
- 1. List item
1292
- More item 1
1293
- 2. List item
1294
- More item 2
1295
- ```
1296
-
1297
- Although it is not indented, the text "More item 2" is referred to as a
1298
- [lazy continuation line][lazy-continuation] and considered part of the second
1299
- list item.
1300
-
1301
- Rationale: In addition to aesthetic reasons, some parsers, including kramdown,
1302
- will not parse lists that don't have blank lines before and after them.
1303
-
1304
- [lazy-continuation]: https://spec.commonmark.org/0.30/#lazy-continuation-line
1305
-
1306
- <a name="md033"></a>
1307
-
1308
- ## `MD033` - Inline HTML
1309
-
1310
- Tags: `html`
1311
-
1312
- Aliases: `no-inline-html`
1313
-
1314
- Parameters:
1315
-
1316
- - `allowed_elements`: Allowed elements (`string[]`, default `[]`)
1317
-
1318
- This rule is triggered whenever raw HTML is used in a Markdown document:
1319
-
1320
- ```markdown
1321
- <h1>Inline HTML heading</h1>
1322
- ```
1323
-
1324
- To fix this, use 'pure' Markdown instead of including raw HTML:
1325
-
1326
- ```markdown
1327
- # Markdown heading
1328
- ```
1329
-
1330
- Note: To allow specific HTML elements, use the `allowed_elements` parameter.
1331
-
1332
- Rationale: Raw HTML is allowed in Markdown, but this rule is included for
1333
- those who want their documents to only include "pure" Markdown, or for those
1334
- who are rendering Markdown documents into something other than HTML.
1335
-
1336
- <a name="md034"></a>
1337
-
1338
- ## `MD034` - Bare URL used
1339
-
1340
- Tags: `links`, `url`
1341
-
1342
- Aliases: `no-bare-urls`
1343
-
1344
- Fixable: Some violations can be fixed by tooling
1345
-
1346
- This rule is triggered whenever a URL or email address appears without
1347
- surrounding angle brackets:
1348
-
1349
- ```markdown
1350
- For more info, visit https://www.example.com/ or email user@example.com.
1351
- ```
1352
-
1353
- To fix this, add angle brackets around the URL or email address:
1354
-
1355
- ```markdown
1356
- For more info, visit <https://www.example.com/> or email <user@example.com>.
1357
- ```
1358
-
1359
- Note: To include a bare URL or email without it being converted into a link,
1360
- wrap it in a code span:
1361
-
1362
- ```markdown
1363
- Not a clickable link: `https://www.example.com`
1364
- ```
1365
-
1366
- Note: The following scenario does not trigger this rule because it could be a
1367
- shortcut link:
1368
-
1369
- ```markdown
1370
- [https://www.example.com]
1371
- ```
1372
-
1373
- Note: The following syntax triggers this rule because the nested link could be
1374
- a shortcut link (which takes precedence):
1375
-
1376
- ```markdown
1377
- [text [shortcut] text](https://example.com)
1378
- ```
1379
-
1380
- To avoid this, escape both inner brackets:
1381
-
1382
- ```markdown
1383
- [link \[text\] link](https://example.com)
1384
- ```
1385
-
1386
- Rationale: Without angle brackets, a bare URL or email isn't converted into a
1387
- link by some Markdown parsers.
1388
-
1389
- <a name="md035"></a>
1390
-
1391
- ## `MD035` - Horizontal rule style
1392
-
1393
- Tags: `hr`
1394
-
1395
- Aliases: `hr-style`
1396
-
1397
- Parameters:
1398
-
1399
- - `style`: Horizontal rule style (`string`, default `consistent`)
1400
-
1401
- This rule is triggered when inconsistent styles of horizontal rules are used
1402
- in the document:
1403
-
1404
- ```markdown
1405
- ---
1406
-
1407
- - - -
1408
-
1409
- ***
1410
-
1411
- * * *
1412
-
1413
- ****
1414
- ```
1415
-
1416
- To fix this, ensure any horizontal rules used in the document are consistent,
1417
- or match the given style if the rule is so configured:
1418
-
1419
- ```markdown
1420
- ---
1421
-
1422
- ---
1423
- ```
1424
-
1425
- Note: by default, this rule is configured to just require that all horizontal
1426
- rules in the document are the same and will trigger if any of the horizontal
1427
- rules are different than the first one encountered in the document. If you
1428
- want to configure the rule to match a specific style, the parameter given to
1429
- the 'style' option is a string containing the exact horizontal rule text that
1430
- is allowed.
1431
-
1432
- Rationale: Consistent formatting makes it easier to understand a document.
1433
-
1434
- <a name="md036"></a>
1435
-
1436
- ## `MD036` - Emphasis used instead of a heading
1437
-
1438
- Tags: `emphasis`, `headings`
1439
-
1440
- Aliases: `no-emphasis-as-heading`
1441
-
1442
- Parameters:
1443
-
1444
- - `punctuation`: Punctuation characters (`string`, default `.,;:!?。,;:!?`)
1445
-
1446
- This check looks for instances where emphasized (i.e. bold or italic) text is
1447
- used to separate sections, where a heading should be used instead:
1448
-
1449
- ```markdown
1450
- **My document**
1451
-
1452
- Lorem ipsum dolor sit amet...
1453
-
1454
- _Another section_
1455
-
1456
- Consectetur adipiscing elit, sed do eiusmod.
1457
- ```
1458
-
1459
- To fix this, use Markdown headings instead of emphasized text to denote
1460
- sections:
1461
-
1462
- ```markdown
1463
- # My document
1464
-
1465
- Lorem ipsum dolor sit amet...
1466
-
1467
- ## Another section
1468
-
1469
- Consectetur adipiscing elit, sed do eiusmod.
1470
- ```
1471
-
1472
- Note: This rule looks for single-line paragraphs that consist entirely
1473
- of emphasized text. It won't fire on emphasis used within regular text,
1474
- multi-line emphasized paragraphs, or paragraphs ending in punctuation
1475
- (normal or full-width). Similarly to rule MD026, you can configure what
1476
- characters are recognized as punctuation.
1477
-
1478
- Rationale: Using emphasis instead of a heading prevents tools from inferring
1479
- the structure of a document. More information:
1480
- <https://cirosantilli.com/markdown-style-guide#emphasis-vs-headers>.
1481
-
1482
- <a name="md037"></a>
1483
-
1484
- ## `MD037` - Spaces inside emphasis markers
1485
-
1486
- Tags: `emphasis`, `whitespace`
1487
-
1488
- Aliases: `no-space-in-emphasis`
1489
-
1490
- Fixable: Some violations can be fixed by tooling
1491
-
1492
- This rule is triggered when emphasis markers (bold, italic) are used, but they
1493
- have spaces between the markers and the text:
1494
-
1495
- ```markdown
1496
- Here is some ** bold ** text.
1497
-
1498
- Here is some * italic * text.
1499
-
1500
- Here is some more __ bold __ text.
1501
-
1502
- Here is some more _ italic _ text.
1503
- ```
1504
-
1505
- To fix this, remove the spaces around the emphasis markers:
1506
-
1507
- ```markdown
1508
- Here is some **bold** text.
1509
-
1510
- Here is some *italic* text.
1511
-
1512
- Here is some more __bold__ text.
1513
-
1514
- Here is some more _italic_ text.
1515
- ```
1516
-
1517
- Rationale: Emphasis is only parsed as such when the asterisks/underscores
1518
- aren't surrounded by spaces. This rule attempts to detect where
1519
- they were surrounded by spaces, but it appears that emphasized text was
1520
- intended by the author.
1521
-
1522
- <a name="md038"></a>
1523
-
1524
- ## `MD038` - Spaces inside code span elements
1525
-
1526
- Tags: `code`, `whitespace`
1527
-
1528
- Aliases: `no-space-in-code`
1529
-
1530
- Fixable: Some violations can be fixed by tooling
1531
-
1532
- This rule is triggered for code span elements that have spaces adjacent to the
1533
- backticks:
1534
-
1535
- ```markdown
1536
- `some text `
1537
-
1538
- ` some text`
1539
- ```
1540
-
1541
- To fix this, remove any spaces adjacent to the backticks:
1542
-
1543
- ```markdown
1544
- `some text`
1545
- ```
1546
-
1547
- Note: A single leading and trailing space is allowed by the specification and
1548
- automatically trimmed (in order to allow for code spans that embed backticks):
1549
-
1550
- ```markdown
1551
- `` `backticks` ``
1552
- ```
1553
-
1554
- Note: A single leading or trailing space is allowed if used to separate code
1555
- span markers from an embedded backtick (though the space is not trimmed):
1556
-
1557
- ```markdown
1558
- `` ` embedded backtick``
1559
- ```
1560
-
1561
- Rationale: Violations of this rule are usually unintentional and may lead to
1562
- improperly-rendered content. If spaces beside backticks are intentional, this
1563
- rule can be disabled for that line or file.
1564
-
1565
- <a name="md039"></a>
1566
-
1567
- ## `MD039` - Spaces inside link text
1568
-
1569
- Tags: `links`, `whitespace`
1570
-
1571
- Aliases: `no-space-in-links`
1572
-
1573
- Fixable: Some violations can be fixed by tooling
1574
-
1575
- This rule is triggered on links that have spaces surrounding the link text:
1576
-
1577
- ```markdown
1578
- [ a link ](https://www.example.com/)
1579
- ```
1580
-
1581
- To fix this, remove the spaces surrounding the link text:
1582
-
1583
- ```markdown
1584
- [a link](https://www.example.com/)
1585
- ```
1586
-
1587
- Rationale: Consistent formatting makes it easier to understand a document.
1588
-
1589
- <a name="md040"></a>
1590
-
1591
- ## `MD040` - Fenced code blocks should have a language specified
1592
-
1593
- Tags: `code`, `language`
1594
-
1595
- Aliases: `fenced-code-language`
1596
-
1597
- Parameters:
1598
-
1599
- - `allowed_languages`: List of languages (`string[]`, default `[]`)
1600
- - `language_only`: Require language only (`boolean`, default `false`)
1601
-
1602
- This rule is triggered when fenced code blocks are used, but a language isn't
1603
- specified:
1604
-
1605
- ````markdown
1606
- ```
1607
- #!/bin/bash
1608
- echo Hello world
1609
- ```
1610
- ````
1611
-
1612
- To fix this, add a language specifier to the code block:
1613
-
1614
- ````markdown
1615
- ```bash
1616
- #!/bin/bash
1617
- echo Hello world
1618
- ```
1619
- ````
1620
-
1621
- To display a code block without syntax highlighting, use:
1622
-
1623
- ````markdown
1624
- ```text
1625
- Plain text in a code block
1626
- ```
1627
- ````
1628
-
1629
- You can configure the `allowed_languages` parameter to specify a list of
1630
- languages code blocks could use. Languages are case sensitive. The default value
1631
- is `[]` which means any language specifier is valid.
1632
-
1633
- You can prevent extra data from being present in the info string of fenced code
1634
- blocks. To do so, set the `language_only` parameter to `true`.
1635
-
1636
- <!-- markdownlint-disable-next-line no-space-in-code -->
1637
- Info strings with leading/trailing whitespace (ex: `js `) or other content (ex:
1638
- `ruby startline=3`) will trigger this rule.
1639
-
1640
- Rationale: Specifying a language improves content rendering by using the
1641
- correct syntax highlighting for code. More information:
1642
- <https://cirosantilli.com/markdown-style-guide#option-code-fenced>.
1643
-
1644
- <a name="md041"></a>
1645
-
1646
- ## `MD041` - First line in a file should be a top-level heading
1647
-
1648
- Tags: `headings`
1649
-
1650
- Aliases: `first-line-h1`, `first-line-heading`
1651
-
1652
- Parameters:
1653
-
1654
- - `front_matter_title`: RegExp for matching title in front matter (`string`,
1655
- default `^\s*title\s*[:=]`)
1656
- - `level`: Heading level (`integer`, default `1`)
1657
-
1658
- This rule is intended to ensure documents have a title and is triggered when
1659
- the first line in the file isn't a top-level (h1) heading:
1660
-
1661
- ```markdown
1662
- This is a file without a heading
1663
- ```
1664
-
1665
- To fix this, add a top-level heading to the beginning of the file:
1666
-
1667
- ```markdown
1668
- # File with heading
1669
-
1670
- This is a file with a top-level heading
1671
- ```
1672
-
1673
- Because it is common for projects on GitHub to use an image for the heading of
1674
- `README.md` and that is not well-supported by Markdown, HTML headings are also
1675
- permitted by this rule. For example:
1676
-
1677
- ```markdown
1678
- <h1 align="center"><img src="https://placekitten.com/300/150"/></h1>
1679
-
1680
- This is a file with a top-level HTML heading
1681
- ```
1682
-
1683
- Note: The `level` parameter can be used to change the top-level (ex: to h2) in
1684
- cases where an h1 is added externally.
1685
-
1686
- If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
1687
- contains a `title` property (commonly used with blog posts), this rule will not
1688
- report a violation. To use a different property name in the front matter,
1689
- specify the text of a regular expression via the `front_matter_title` parameter.
1690
- To disable the use of front matter by this rule, specify `""` for
1691
- `front_matter_title`.
1692
-
1693
- Rationale: The top-level heading often acts as the title of a document. More
1694
- information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
1695
-
1696
- <a name="md042"></a>
1697
-
1698
- ## `MD042` - No empty links
1699
-
1700
- Tags: `links`
1701
-
1702
- Aliases: `no-empty-links`
1703
-
1704
- This rule is triggered when an empty link is encountered:
1705
-
1706
- ```markdown
1707
- [an empty link]()
1708
- ```
1709
-
1710
- To fix the violation, provide a destination for the link:
1711
-
1712
- ```markdown
1713
- [a valid link](https://example.com/)
1714
- ```
1715
-
1716
- Empty fragments will trigger this rule:
1717
-
1718
- ```markdown
1719
- [an empty fragment](#)
1720
- ```
1721
-
1722
- But non-empty fragments will not:
1723
-
1724
- ```markdown
1725
- [a valid fragment](#fragment)
1726
- ```
1727
-
1728
- Rationale: Empty links do not lead anywhere and therefore don't function as
1729
- links.
1730
-
1731
- <a name="md043"></a>
1732
-
1733
- ## `MD043` - Required heading structure
1734
-
1735
- Tags: `headings`
1736
-
1737
- Aliases: `required-headings`
1738
-
1739
- Parameters:
1740
-
1741
- - `headings`: List of headings (`string[]`, default `[]`)
1742
- - `match_case`: Match case of headings (`boolean`, default `false`)
1743
-
1744
- This rule is triggered when the headings in a file do not match the array of
1745
- headings passed to the rule. It can be used to enforce a standard heading
1746
- structure for a set of files.
1747
-
1748
- To require exactly the following structure:
1749
-
1750
- ```markdown
1751
- # Head
1752
- ## Item
1753
- ### Detail
1754
- ```
1755
-
1756
- Set the `headings` parameter to:
1757
-
1758
- ```json
1759
- [
1760
- "# Head",
1761
- "## Item",
1762
- "### Detail"
1763
- ]
1764
- ```
1765
-
1766
- To allow optional headings as with the following structure:
1767
-
1768
- ```markdown
1769
- # Head
1770
- ## Item
1771
- ### Detail (optional)
1772
- ## Foot
1773
- ### Notes (optional)
1774
- ```
1775
-
1776
- Use the special value `"*"` meaning "zero or more unspecified headings" or the
1777
- special value `"+"` meaning "one or more unspecified headings" and set the
1778
- `headings` parameter to:
1779
-
1780
- ```json
1781
- [
1782
- "# Head",
1783
- "## Item",
1784
- "*",
1785
- "## Foot",
1786
- "*"
1787
- ]
1788
- ```
1789
-
1790
- When an error is detected, this rule outputs the line number of the first
1791
- problematic heading (otherwise, it outputs the last line number of the file).
1792
-
1793
- Note that while the `headings` parameter uses the "## Text" ATX heading style
1794
- for simplicity, a file may use any supported heading style.
1795
-
1796
- By default, the case of headings in the document is not required to match that
1797
- of `headings`. To require that case match exactly, set the `match_case`
1798
- parameter to `true`.
1799
-
1800
- Rationale: Projects may wish to enforce a consistent document structure across
1801
- a set of similar content.
1802
-
1803
- <a name="md044"></a>
1804
-
1805
- ## `MD044` - Proper names should have the correct capitalization
1806
-
1807
- Tags: `spelling`
1808
-
1809
- Aliases: `proper-names`
1810
-
1811
- Parameters:
1812
-
1813
- - `code_blocks`: Include code blocks (`boolean`, default `true`)
1814
- - `html_elements`: Include HTML elements (`boolean`, default `true`)
1815
- - `names`: List of proper names (`string[]`, default `[]`)
1816
-
1817
- Fixable: Some violations can be fixed by tooling
1818
-
1819
- This rule is triggered when any of the strings in the `names` array do not have
1820
- the specified capitalization. It can be used to enforce a standard letter case
1821
- for the names of projects and products.
1822
-
1823
- For example, the language "JavaScript" is usually written with both the 'J' and
1824
- 'S' capitalized - though sometimes the 's' or 'j' appear in lower-case. To
1825
- enforce the proper capitalization, specify the desired letter case in the
1826
- `names` array:
1827
-
1828
- ```json
1829
- [
1830
- "JavaScript"
1831
- ]
1832
- ```
1833
-
1834
- Set the `code_blocks` parameter to `false` to disable this rule for code blocks
1835
- and spans. Set the `html_elements` parameter to `false` to disable this rule
1836
- for HTML elements and attributes (such as when using a proper name as part of
1837
- a path for `a`/`href` or `img`/`src`).
1838
-
1839
- Rationale: Incorrect capitalization of proper names is usually a mistake.
1840
-
1841
- <a name="md045"></a>
1842
-
1843
- ## `MD045` - Images should have alternate text (alt text)
1844
-
1845
- Tags: `accessibility`, `images`
1846
-
1847
- Aliases: `no-alt-text`
1848
-
1849
- This rule is triggered when an image is missing alternate text (alt text)
1850
- information.
1851
-
1852
- Alternate text is commonly specified inline as:
1853
-
1854
- ```markdown
1855
- ![Alternate text](image.jpg)
1856
- ```
1857
-
1858
- Or with reference syntax as:
1859
-
1860
- ```markdown
1861
- ![Alternate text][ref]
1862
-
1863
- ...
1864
-
1865
- [ref]: image.jpg "Optional title"
1866
- ```
1867
-
1868
- Or with HTML as:
1869
-
1870
- ```html
1871
- <img src="image.jpg" alt="Alternate text" />
1872
- ```
1873
-
1874
- Guidance for writing alternate text is available from the [W3C][w3c],
1875
- [Wikipedia][wikipedia], and [other locations][phase2technology].
1876
-
1877
- Rationale: Alternate text is important for accessibility and describes the
1878
- content of an image for people who may not be able to see it.
1879
-
1880
- [phase2technology]: https://www.phase2technology.com/blog/no-more-excuses
1881
- [w3c]: https://www.w3.org/WAI/alt/
1882
- [wikipedia]: https://en.wikipedia.org/wiki/Alt_attribute
1883
-
1884
- <a name="md046"></a>
1885
-
1886
- ## `MD046` - Code block style
1887
-
1888
- Tags: `code`
1889
-
1890
- Aliases: `code-block-style`
1891
-
1892
- Parameters:
1893
-
1894
- - `style`: Block style (`string`, default `consistent`, values `consistent` /
1895
- `fenced` / `indented`)
1896
-
1897
- This rule is triggered when unwanted or different code block styles are used in
1898
- the same document.
1899
-
1900
- In the default configuration this rule reports a violation for the following
1901
- document:
1902
-
1903
- <!-- markdownlint-disable code-block-style -->
1904
-
1905
- Some text.
1906
-
1907
- # Indented code
1908
-
1909
- More text.
1910
-
1911
- ```ruby
1912
- # Fenced code
1913
- ```
1914
-
1915
- More text.
1916
-
1917
- <!-- markdownlint-restore -->
1918
-
1919
- To fix violations of this rule, use a consistent style (either indenting or code
1920
- fences).
1921
-
1922
- The specified style can be specific (`fenced`, `indented`) or simply require
1923
- that usage be consistent within the document (`consistent`).
1924
-
1925
- Rationale: Consistent formatting makes it easier to understand a document.
1926
-
1927
- <a name="md047"></a>
1928
-
1929
- ## `MD047` - Files should end with a single newline character
1930
-
1931
- Tags: `blank_lines`
1932
-
1933
- Aliases: `single-trailing-newline`
1934
-
1935
- Fixable: Some violations can be fixed by tooling
1936
-
1937
- This rule is triggered when there is not a single newline character at the end
1938
- of a file.
1939
-
1940
- An example that triggers the rule:
1941
-
1942
- ```markdown
1943
- # Heading
1944
-
1945
- This file ends without a newline.[EOF]
1946
- ```
1947
-
1948
- To fix the violation, add a newline character to the end of the file:
1949
-
1950
- ```markdown
1951
- # Heading
1952
-
1953
- This file ends with a newline.
1954
- [EOF]
1955
- ```
1956
-
1957
- Rationale: Some programs have trouble with files that do not end with a newline.
1958
-
1959
- More information: [What's the point in adding a new line to the end of a
1960
- file?][stack-exchange]
1961
-
1962
- [stack-exchange]: https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file
1963
-
1964
- <a name="md048"></a>
1965
-
1966
- ## `MD048` - Code fence style
1967
-
1968
- Tags: `code`
1969
-
1970
- Aliases: `code-fence-style`
1971
-
1972
- Parameters:
1973
-
1974
- - `style`: Code fence style (`string`, default `consistent`, values `backtick`
1975
- / `consistent` / `tilde`)
1976
-
1977
- This rule is triggered when the symbols used in the document for fenced code
1978
- blocks do not match the configured code fence style:
1979
-
1980
- ````markdown
1981
- ```ruby
1982
- # Fenced code
1983
- ```
1984
-
1985
- ~~~ruby
1986
- # Fenced code
1987
- ~~~
1988
- ````
1989
-
1990
- To fix this issue, use the configured code fence style throughout the
1991
- document:
1992
-
1993
- ````markdown
1994
- ```ruby
1995
- # Fenced code
1996
- ```
1997
-
1998
- ```ruby
1999
- # Fenced code
2000
- ```
2001
- ````
2002
-
2003
- The configured list style can be a specific symbol to use (backtick, tilde), or
2004
- can require that usage be consistent within the document.
2005
-
2006
- Rationale: Consistent formatting makes it easier to understand a document.
2007
-
2008
- <a name="md049"></a>
2009
-
2010
- ## `MD049` - Emphasis style
2011
-
2012
- Tags: `emphasis`
2013
-
2014
- Aliases: `emphasis-style`
2015
-
2016
- Parameters:
2017
-
2018
- - `style`: Emphasis style (`string`, default `consistent`, values `asterisk` /
2019
- `consistent` / `underscore`)
2020
-
2021
- Fixable: Some violations can be fixed by tooling
2022
-
2023
- This rule is triggered when the symbols used in the document for emphasis do not
2024
- match the configured emphasis style:
2025
-
2026
- ```markdown
2027
- *Text*
2028
- _Text_
2029
- ```
2030
-
2031
- To fix this issue, use the configured emphasis style throughout the document:
2032
-
2033
- ```markdown
2034
- *Text*
2035
- *Text*
2036
- ```
2037
-
2038
- The configured emphasis style can be a specific symbol to use ("asterisk",
2039
- "underscore"), or can require that usage be consistent within the document.
2040
-
2041
- Rationale: Consistent formatting makes it easier to understand a document.
2042
-
2043
- <a name="md050"></a>
2044
-
2045
- ## `MD050` - Strong style
2046
-
2047
- Tags: `emphasis`
2048
-
2049
- Aliases: `strong-style`
2050
-
2051
- Parameters:
2052
-
2053
- - `style`: Strong style (`string`, default `consistent`, values `asterisk` /
2054
- `consistent` / `underscore`)
2055
-
2056
- Fixable: Some violations can be fixed by tooling
2057
-
2058
- This rule is triggered when the symbols used in the document for strong do not
2059
- match the configured strong style:
2060
-
2061
- ```markdown
2062
- **Text**
2063
- __Text__
2064
- ```
2065
-
2066
- To fix this issue, use the configured strong style throughout the document:
2067
-
2068
- ```markdown
2069
- **Text**
2070
- **Text**
2071
- ```
2072
-
2073
- The configured strong style can be a specific symbol to use ("asterisk",
2074
- "underscore"), or can require that usage be consistent within the document.
2075
-
2076
- Rationale: Consistent formatting makes it easier to understand a document.
2077
-
2078
- <a name="md051"></a>
2079
-
2080
- ## `MD051` - Link fragments should be valid
2081
-
2082
- Tags: `links`
2083
-
2084
- Aliases: `link-fragments`
2085
-
2086
- Fixable: Some violations can be fixed by tooling
2087
-
2088
- This rule is triggered when a link fragment does not match any of the fragments
2089
- that are automatically generated for headings in a document:
2090
-
2091
- ```markdown
2092
- # Heading Name
2093
-
2094
- [Link](#fragment)
2095
- ```
2096
-
2097
- To fix this issue, change the link fragment to reference an existing heading's
2098
- generated name (see below):
2099
-
2100
- ```markdown
2101
- # Heading Name
2102
-
2103
- [Link](#heading-name)
2104
- ```
2105
-
2106
- Alternatively, some platforms allow the syntax `{#named-anchor}` to be used
2107
- within a heading to provide a specific name (consisting of only lower-case
2108
- letters, numbers, `-`, and `_`):
2109
-
2110
- ```markdown
2111
- # Heading Name {#custom-name}
2112
-
2113
- [Link](#custom-name)
2114
- ```
2115
-
2116
- Alternatively, any HTML tag with an `id` attribute or an `a` tag with a `name`
2117
- attribute can be used to define a fragment:
2118
-
2119
- ```markdown
2120
- <a id="bookmark"></a>
2121
-
2122
- [Link](#bookmark)
2123
- ```
2124
-
2125
- An `a` tag can be useful in scenarios where a heading is not appropriate or for
2126
- control over the text of the fragment identifier.
2127
-
2128
- Rationale: [GitHub section links][github-section-links] are created
2129
- automatically for every heading when Markdown content is displayed on GitHub.
2130
- This makes it easy to link directly to different sections within a document.
2131
- However, section links change if headings are renamed or removed. This rule
2132
- helps identify broken section links within a document.
2133
-
2134
- Section links are **not** part of the CommonMark specification. This rule
2135
- enforces the [GitHub heading algorithm][github-heading-algorithm] which is:
2136
- convert heading to lowercase, remove punctuation, convert spaces to dashes,
2137
- append an incrementing integer as needed for uniqueness.
2138
-
2139
- [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
2140
- [github-heading-algorithm]: https://github.com/gjtorikian/html-pipeline/blob/f13a1534cb650ba17af400d1acd3a22c28004c09/lib/html/pipeline/toc_filter.rb
2141
-
2142
- <a name="md052"></a>
2143
-
2144
- ## `MD052` - Reference links and images should use a label that is defined
2145
-
2146
- Tags: `images`, `links`
2147
-
2148
- Aliases: `reference-links-images`
2149
-
2150
- Parameters:
2151
-
2152
- - `shortcut_syntax`: Include shortcut syntax (`boolean`, default `false`)
2153
-
2154
- Links and images in Markdown can provide the link destination or image source
2155
- at the time of use or can define it elsewhere and use a label for reference.
2156
- The reference format is convenient for keeping paragraph text clutter-free
2157
- and makes it easy to reuse the same URL in multiple places.
2158
-
2159
- There are three kinds of reference links and images:
2160
-
2161
- ```markdown
2162
- Full: [text][label]
2163
- Collapsed: [label][]
2164
- Shortcut: [label]
2165
-
2166
- Full: ![text][image]
2167
- Collapsed: ![image][]
2168
- Shortcut: ![image]
2169
-
2170
- [label]: https://example.com/label
2171
- [image]: https://example.com/image
2172
- ```
2173
-
2174
- A link or image renders correctly when the corresponding label is defined, but
2175
- displays as text with brackets when the label is not present. By default, this
2176
- rule warns of undefined labels for "full" and "collapsed" reference syntax but
2177
- not for "shortcut" syntax because it is ambiguous.
2178
-
2179
- The text `[example]` could be a shortcut link or the text "example" in brackets,
2180
- so "shortcut" syntax is ignored by default. To include "shortcut" syntax, set
2181
- the `include_shortcut` parameter to `true`. Note that doing so produces warnings
2182
- for *all* text in the document that *could* be a shortcut. If bracketed text is
2183
- intentional, brackets can be escaped with the `\` character: `\[example\]`.
2184
-
2185
- <a name="md053"></a>
2186
-
2187
- ## `MD053` - Link and image reference definitions should be needed
2188
-
2189
- Tags: `images`, `links`
2190
-
2191
- Aliases: `link-image-reference-definitions`
2192
-
2193
- Parameters:
2194
-
2195
- - `ignored_definitions`: Ignored definitions (`string[]`, default `["//"]`)
2196
-
2197
- Fixable: Some violations can be fixed by tooling
2198
-
2199
- Links and images in Markdown can provide the link destination or image source
2200
- at the time of use or can use a label to reference a definition elsewhere in
2201
- the document. The latter reference format is convenient for keeping paragraph
2202
- text clutter-free and makes it easy to reuse the same URL in multiple places.
2203
-
2204
- Because link and image reference definitions are located separately from
2205
- where they are used, there are two scenarios where a definition can be
2206
- unnecessary:
2207
-
2208
- 1. If a label is not referenced by any link or image in a document, that
2209
- definition is unused and can be deleted.
2210
- 2. If a label is defined multiple times in a document, the first definition is
2211
- used and the others can be deleted.
2212
-
2213
- This rule considers a reference definition to be used if any link or image
2214
- reference has the corresponding label. The "full", "collapsed", and "shortcut"
2215
- formats are all supported.
2216
-
2217
- If there are reference definitions that are deliberately unreferenced, they can
2218
- be ignored by setting the `ignored_definitions` parameter. The default value of
2219
- this parameter ignores the following convention for adding non-HTML comments to
2220
- Markdown:
2221
-
2222
- ```markdown
2223
- [//]: # (This behaves like a comment)
2224
- ```
2225
-
2226
- <a name="md054"></a>
2227
-
2228
- ## `MD054` - Link and image style
2229
-
2230
- Tags: `images`, `links`
2231
-
2232
- Aliases: `link-image-style`
2233
-
2234
- Parameters:
2235
-
2236
- - `autolink`: Allow autolinks (`boolean`, default `true`)
2237
- - `collapsed`: Allow collapsed reference links and images (`boolean`, default
2238
- `true`)
2239
- - `full`: Allow full reference links and images (`boolean`, default `true`)
2240
- - `inline`: Allow inline links and images (`boolean`, default `true`)
2241
- - `shortcut`: Allow shortcut reference links and images (`boolean`, default
2242
- `true`)
2243
- - `url_inline`: Allow URLs as inline links (`boolean`, default `true`)
2244
-
2245
- Fixable: Some violations can be fixed by tooling
2246
-
2247
- Links and images in Markdown can provide the link destination or image source at
2248
- the time of use or can use a label to reference a definition elsewhere in the
2249
- document. The three reference formats are convenient for keeping paragraph text
2250
- clutter-free and make it easy to reuse the same URL in multiple places.
2251
-
2252
- By default, this rule allows all link/image styles.
2253
-
2254
- Setting the `autolink` parameter to `false` disables autolinks:
2255
-
2256
- ```markdown
2257
- <https://example.com>
2258
- ```
2259
-
2260
- Setting the `inline` parameter to `false` disables inline links and images:
2261
-
2262
- ```markdown
2263
- [link](https://example.com)
2264
-
2265
- ![image](https://example.com)
2266
- ```
2267
-
2268
- Setting the `full` parameter to `false` disables full reference links and
2269
- images:
2270
-
2271
- ```markdown
2272
- [link][url]
2273
-
2274
- ![image][url]
2275
-
2276
- [url]: https://example.com
2277
- ```
2278
-
2279
- Setting the `collapsed` parameter to `false` disables collapsed reference links
2280
- and images:
2281
-
2282
- ```markdown
2283
- [url][]
2284
-
2285
- ![url][]
2286
-
2287
- [url]: https://example.com
2288
- ```
2289
-
2290
- Setting the `shortcut` parameter to `false` disables shortcut reference links
2291
- and images:
2292
-
2293
- ```markdown
2294
- [url]
2295
-
2296
- ![url]
2297
-
2298
- [url]: https://example.com
2299
- ```
2300
-
2301
- To fix violations of this rule, change the link or image to use an allowed
2302
- style. This rule can automatically fix violations when a link or image can be
2303
- converted to the `inline` style (preferred) or a link can be converted to the
2304
- `autolink` style (which does not support images and must be an absolute URL).
2305
- This rule does *not* fix scenarios that require converting a link or image to
2306
- the `full`, `collapsed`, or `shortcut` reference styles because that involves
2307
- naming the reference and determining where to insert it in the document.
2308
-
2309
- Setting the `url_inline` parameter to `false` prevents the use of inline links
2310
- with the same absolute URL text/destination and no title because such links can
2311
- be converted to autolinks:
2312
-
2313
- ```markdown
2314
- [https://example.com](https://example.com)
2315
- ```
2316
-
2317
- To fix `url_inline` violations, use the simpler autolink syntax instead:
2318
-
2319
- ```markdown
2320
- <https://example.com>
2321
- ```
2322
-
2323
- Rationale: Consistent formatting makes it easier to understand a document.
2324
- Autolinks are concise, but appear as URLs which can be long and confusing.
2325
- Inline links and images can include descriptive text, but take up more space in
2326
- Markdown form. Reference links and images can be easier to read and manipulate
2327
- in Markdown form, but require a separate link reference definition.
2328
-
2329
- <!-- markdownlint-configure-file {
2330
- "no-inline-html": {
2331
- "allowed_elements": [
2332
- "a"
2333
- ]
2334
- }
2335
- } -->