@alexlit/lint-kit 107.3.0 → 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 (247) hide show
  1. package/.eslintrc.cjs +7 -1
  2. package/.linthtmlrc.cjs +3 -1
  3. package/{.commitlintrc.cjs → commitlint.config.js} +1 -1
  4. package/package.json +5 -5
  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/index.js +12 -2
  11. package/packages/config-eslint/package.json +25 -25
  12. package/packages/config-eslint/plugins/typescript/index.js +1 -1
  13. package/packages/config-eslint/plugins/unicorn.js +2 -0
  14. package/packages/config-eslint/plugins/vue.js +34 -2
  15. package/packages/config-hooks/LICENSE +20 -0
  16. package/packages/config-hooks/README.md +18 -12
  17. package/packages/config-hooks/index.js +2 -0
  18. package/packages/config-hooks/lint-staged.js +1 -1
  19. package/packages/config-hooks/package.json +6 -5
  20. package/packages/config-htmllint/LICENSE +20 -0
  21. package/packages/config-markdownlint/LICENSE +20 -0
  22. package/packages/config-markdownlint/package.json +3 -3
  23. package/packages/config-npmlint/LICENSE +20 -0
  24. package/packages/config-npmlint/package.json +2 -2
  25. package/packages/config-prettier/LICENSE +20 -0
  26. package/packages/config-prettier/README.md +8 -3
  27. package/packages/config-prettier/index.js +14 -10
  28. package/packages/config-prettier/package.json +16 -12
  29. package/packages/config-prettier/plugins/jsdoc.js +1 -1
  30. package/packages/config-prettier/plugins/pug.js +1 -1
  31. package/packages/config-prettier/plugins/sort-json.js +1 -1
  32. package/packages/config-prettier/plugins/svelte.js +1 -1
  33. package/packages/config-prettier/plugins/tailwindcss.js +1 -1
  34. package/packages/config-prettier/plugins/xml.js +1 -1
  35. package/packages/config-stylelint/LICENSE +20 -0
  36. package/packages/config-stylelint/README.md +5 -4
  37. package/packages/config-stylelint/index.js +22 -25
  38. package/packages/config-stylelint/package.json +22 -18
  39. package/packages/config-stylelint/plugins/a11y.js +1 -1
  40. package/packages/config-stylelint/plugins/at-rule-no-children.js +1 -1
  41. package/packages/config-stylelint/plugins/color-format.js +1 -1
  42. package/packages/config-stylelint/plugins/declaration-block-no-ignored-properties.js +1 -1
  43. package/packages/config-stylelint/plugins/high-performance-animation.js +1 -1
  44. package/packages/config-stylelint/plugins/no-nested-media.js +1 -1
  45. package/packages/config-stylelint/plugins/no-unresolved-module.js +1 -1
  46. package/packages/config-stylelint/plugins/no-unsupported-browser-features.js +1 -1
  47. package/packages/config-stylelint/plugins/optional/gamut.js +1 -1
  48. package/packages/config-stylelint/plugins/optional/logical-css.js +1 -1
  49. package/packages/config-stylelint/plugins/optional/no-indistinguishable-colors.js +1 -1
  50. package/packages/config-stylelint/plugins/order.js +1 -1
  51. package/packages/config-stylelint/plugins/prettier.js +1 -1
  52. package/packages/config-stylelint/plugins/scss.js +1 -1
  53. package/packages/config-stylelint/plugins/selector-no-empty.js +1 -1
  54. package/packages/config-stylelint/plugins/use-nesting.js +1 -1
  55. package/packages/config-stylelint/plugins/vue.js +1 -1
  56. package/prettier.config.js +5 -0
  57. package/stylelint.config.js +14 -0
  58. package/.huskyrc.cjs +0 -3
  59. package/.lintstagedrc.cjs +0 -3
  60. package/.prettierrc.cjs +0 -3
  61. package/.stylelintrc.cjs +0 -4
  62. package/packages/config-hooks/husky.js +0 -6
  63. package/packages/config-markdownlint/node_modules/markdown-it/LICENSE +0 -22
  64. package/packages/config-markdownlint/node_modules/markdown-it/README.md +0 -309
  65. package/packages/config-markdownlint/node_modules/markdown-it/bin/markdown-it.js +0 -117
  66. package/packages/config-markdownlint/node_modules/markdown-it/dist/markdown-it.js +0 -8441
  67. package/packages/config-markdownlint/node_modules/markdown-it/dist/markdown-it.min.js +0 -3
  68. package/packages/config-markdownlint/node_modules/markdown-it/index.js +0 -4
  69. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/entities.js +0 -6
  70. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/html_blocks.js +0 -70
  71. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/html_re.js +0 -28
  72. package/packages/config-markdownlint/node_modules/markdown-it/lib/common/utils.js +0 -317
  73. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/index.js +0 -7
  74. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_destination.js +0 -80
  75. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_label.js +0 -48
  76. package/packages/config-markdownlint/node_modules/markdown-it/lib/helpers/parse_link_title.js +0 -55
  77. package/packages/config-markdownlint/node_modules/markdown-it/lib/index.js +0 -582
  78. package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_block.js +0 -131
  79. package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_core.js +0 -61
  80. package/packages/config-markdownlint/node_modules/markdown-it/lib/parser_inline.js +0 -192
  81. package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/commonmark.js +0 -81
  82. package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/default.js +0 -41
  83. package/packages/config-markdownlint/node_modules/markdown-it/lib/presets/zero.js +0 -63
  84. package/packages/config-markdownlint/node_modules/markdown-it/lib/renderer.js +0 -341
  85. package/packages/config-markdownlint/node_modules/markdown-it/lib/ruler.js +0 -352
  86. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/blockquote.js +0 -226
  87. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/code.js +0 -34
  88. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/fence.js +0 -98
  89. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/heading.js +0 -55
  90. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/hr.js +0 -45
  91. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/html_block.js +0 -74
  92. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/lheading.js +0 -83
  93. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/list.js +0 -362
  94. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/paragraph.js +0 -51
  95. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/reference.js +0 -198
  96. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/state_block.js +0 -231
  97. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_block/table.js +0 -221
  98. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/block.js +0 -16
  99. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/inline.js +0 -13
  100. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/linkify.js +0 -142
  101. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/normalize.js +0 -21
  102. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/replacements.js +0 -105
  103. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/smartquotes.js +0 -201
  104. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/state_core.js +0 -20
  105. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_core/text_join.js +0 -45
  106. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/autolink.js +0 -76
  107. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/backticks.js +0 -63
  108. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/balance_pairs.js +0 -130
  109. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/emphasis.js +0 -130
  110. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/entity.js +0 -55
  111. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/escape.js +0 -71
  112. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/fragments_join.js +0 -41
  113. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/html_inline.js +0 -58
  114. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/image.js +0 -152
  115. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/link.js +0 -150
  116. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/linkify.js +0 -62
  117. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/newline.js +0 -46
  118. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/state_inline.js +0 -158
  119. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/strikethrough.js +0 -130
  120. package/packages/config-markdownlint/node_modules/markdown-it/lib/rules_inline/text.js +0 -89
  121. package/packages/config-markdownlint/node_modules/markdown-it/lib/token.js +0 -201
  122. package/packages/config-markdownlint/node_modules/markdown-it/package.json +0 -87
  123. package/packages/config-markdownlint/node_modules/markdownlint/CHANGELOG.md +0 -428
  124. package/packages/config-markdownlint/node_modules/markdownlint/CONTRIBUTING.md +0 -92
  125. package/packages/config-markdownlint/node_modules/markdownlint/LICENSE +0 -21
  126. package/packages/config-markdownlint/node_modules/markdownlint/README.md +0 -1026
  127. package/packages/config-markdownlint/node_modules/markdownlint/demo/markdownlint-browser.js +0 -6814
  128. package/packages/config-markdownlint/node_modules/markdownlint/doc/CustomRules.md +0 -376
  129. package/packages/config-markdownlint/node_modules/markdownlint/doc/Prettier.md +0 -27
  130. package/packages/config-markdownlint/node_modules/markdownlint/doc/ReleaseProcess.md +0 -20
  131. package/packages/config-markdownlint/node_modules/markdownlint/doc/Rules.md +0 -2335
  132. package/packages/config-markdownlint/node_modules/markdownlint/doc/md001.md +0 -37
  133. package/packages/config-markdownlint/node_modules/markdownlint/doc/md003.md +0 -59
  134. package/packages/config-markdownlint/node_modules/markdownlint/doc/md004.md +0 -49
  135. package/packages/config-markdownlint/node_modules/markdownlint/doc/md005.md +0 -53
  136. package/packages/config-markdownlint/node_modules/markdownlint/doc/md007.md +0 -52
  137. package/packages/config-markdownlint/node_modules/markdownlint/doc/md009.md +0 -51
  138. package/packages/config-markdownlint/node_modules/markdownlint/doc/md010.md +0 -56
  139. package/packages/config-markdownlint/node_modules/markdownlint/doc/md011.md +0 -30
  140. package/packages/config-markdownlint/node_modules/markdownlint/doc/md012.md +0 -38
  141. package/packages/config-markdownlint/node_modules/markdownlint/doc/md013.md +0 -57
  142. package/packages/config-markdownlint/node_modules/markdownlint/doc/md014.md +0 -54
  143. package/packages/config-markdownlint/node_modules/markdownlint/doc/md018.md +0 -27
  144. package/packages/config-markdownlint/node_modules/markdownlint/doc/md019.md +0 -28
  145. package/packages/config-markdownlint/node_modules/markdownlint/doc/md020.md +0 -29
  146. package/packages/config-markdownlint/node_modules/markdownlint/doc/md021.md +0 -31
  147. package/packages/config-markdownlint/node_modules/markdownlint/doc/md022.md +0 -52
  148. package/packages/config-markdownlint/node_modules/markdownlint/doc/md023.md +0 -33
  149. package/packages/config-markdownlint/node_modules/markdownlint/doc/md024.md +0 -47
  150. package/packages/config-markdownlint/node_modules/markdownlint/doc/md025.md +0 -49
  151. package/packages/config-markdownlint/node_modules/markdownlint/doc/md026.md +0 -40
  152. package/packages/config-markdownlint/node_modules/markdownlint/doc/md027.md +0 -24
  153. package/packages/config-markdownlint/node_modules/markdownlint/doc/md028.md +0 -40
  154. package/packages/config-markdownlint/node_modules/markdownlint/doc/md029.md +0 -98
  155. package/packages/config-markdownlint/node_modules/markdownlint/doc/md030.md +0 -82
  156. package/packages/config-markdownlint/node_modules/markdownlint/doc/md031.md +0 -50
  157. package/packages/config-markdownlint/node_modules/markdownlint/doc/md032.md +0 -55
  158. package/packages/config-markdownlint/node_modules/markdownlint/doc/md033.md +0 -27
  159. package/packages/config-markdownlint/node_modules/markdownlint/doc/md034.md +0 -50
  160. package/packages/config-markdownlint/node_modules/markdownlint/doc/md035.md +0 -42
  161. package/packages/config-markdownlint/node_modules/markdownlint/doc/md036.md +0 -45
  162. package/packages/config-markdownlint/node_modules/markdownlint/doc/md037.md +0 -37
  163. package/packages/config-markdownlint/node_modules/markdownlint/doc/md038.md +0 -40
  164. package/packages/config-markdownlint/node_modules/markdownlint/doc/md039.md +0 -21
  165. package/packages/config-markdownlint/node_modules/markdownlint/doc/md040.md +0 -52
  166. package/packages/config-markdownlint/node_modules/markdownlint/doc/md041.md +0 -49
  167. package/packages/config-markdownlint/node_modules/markdownlint/doc/md042.md +0 -32
  168. package/packages/config-markdownlint/node_modules/markdownlint/doc/md043.md +0 -69
  169. package/packages/config-markdownlint/node_modules/markdownlint/doc/md044.md +0 -35
  170. package/packages/config-markdownlint/node_modules/markdownlint/doc/md045.md +0 -40
  171. package/packages/config-markdownlint/node_modules/markdownlint/doc/md046.md +0 -40
  172. package/packages/config-markdownlint/node_modules/markdownlint/doc/md047.md +0 -34
  173. package/packages/config-markdownlint/node_modules/markdownlint/doc/md048.md +0 -41
  174. package/packages/config-markdownlint/node_modules/markdownlint/doc/md049.md +0 -32
  175. package/packages/config-markdownlint/node_modules/markdownlint/doc/md050.md +0 -32
  176. package/packages/config-markdownlint/node_modules/markdownlint/doc/md051.md +0 -61
  177. package/packages/config-markdownlint/node_modules/markdownlint/doc/md052.md +0 -40
  178. package/packages/config-markdownlint/node_modules/markdownlint/doc/md053.md +0 -38
  179. package/packages/config-markdownlint/node_modules/markdownlint/doc/md054.md +0 -100
  180. package/packages/config-markdownlint/node_modules/markdownlint/helpers/LICENSE +0 -21
  181. package/packages/config-markdownlint/node_modules/markdownlint/helpers/README.md +0 -70
  182. package/packages/config-markdownlint/node_modules/markdownlint/helpers/helpers.js +0 -1025
  183. package/packages/config-markdownlint/node_modules/markdownlint/helpers/micromark.cjs +0 -426
  184. package/packages/config-markdownlint/node_modules/markdownlint/helpers/package.json +0 -26
  185. package/packages/config-markdownlint/node_modules/markdownlint/helpers/shared.js +0 -10
  186. package/packages/config-markdownlint/node_modules/markdownlint/lib/cache.js +0 -21
  187. package/packages/config-markdownlint/node_modules/markdownlint/lib/configuration.d.ts +0 -1152
  188. package/packages/config-markdownlint/node_modules/markdownlint/lib/constants.js +0 -14
  189. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.d.ts +0 -406
  190. package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.js +0 -1476
  191. package/packages/config-markdownlint/node_modules/markdownlint/lib/md001.js +0 -22
  192. package/packages/config-markdownlint/node_modules/markdownlint/lib/md003.js +0 -42
  193. package/packages/config-markdownlint/node_modules/markdownlint/lib/md004.js +0 -76
  194. package/packages/config-markdownlint/node_modules/markdownlint/lib/md005.js +0 -73
  195. package/packages/config-markdownlint/node_modules/markdownlint/lib/md007.js +0 -86
  196. package/packages/config-markdownlint/node_modules/markdownlint/lib/md009.js +0 -86
  197. package/packages/config-markdownlint/node_modules/markdownlint/lib/md010.js +0 -60
  198. package/packages/config-markdownlint/node_modules/markdownlint/lib/md011.js +0 -46
  199. package/packages/config-markdownlint/node_modules/markdownlint/lib/md012.js +0 -32
  200. package/packages/config-markdownlint/node_modules/markdownlint/lib/md013.js +0 -96
  201. package/packages/config-markdownlint/node_modules/markdownlint/lib/md014.js +0 -53
  202. package/packages/config-markdownlint/node_modules/markdownlint/lib/md018.js +0 -34
  203. package/packages/config-markdownlint/node_modules/markdownlint/lib/md019.js +0 -39
  204. package/packages/config-markdownlint/node_modules/markdownlint/lib/md020.js +0 -62
  205. package/packages/config-markdownlint/node_modules/markdownlint/lib/md021.js +0 -62
  206. package/packages/config-markdownlint/node_modules/markdownlint/lib/md022.js +0 -108
  207. package/packages/config-markdownlint/node_modules/markdownlint/lib/md023.js +0 -38
  208. package/packages/config-markdownlint/node_modules/markdownlint/lib/md024.js +0 -38
  209. package/packages/config-markdownlint/node_modules/markdownlint/lib/md025.js +0 -32
  210. package/packages/config-markdownlint/node_modules/markdownlint/lib/md026.js +0 -50
  211. package/packages/config-markdownlint/node_modules/markdownlint/lib/md027.js +0 -56
  212. package/packages/config-markdownlint/node_modules/markdownlint/lib/md028.js +0 -30
  213. package/packages/config-markdownlint/node_modules/markdownlint/lib/md029.js +0 -67
  214. package/packages/config-markdownlint/node_modules/markdownlint/lib/md030.js +0 -61
  215. package/packages/config-markdownlint/node_modules/markdownlint/lib/md031.js +0 -40
  216. package/packages/config-markdownlint/node_modules/markdownlint/lib/md032.js +0 -78
  217. package/packages/config-markdownlint/node_modules/markdownlint/lib/md033.js +0 -39
  218. package/packages/config-markdownlint/node_modules/markdownlint/lib/md034.js +0 -79
  219. package/packages/config-markdownlint/node_modules/markdownlint/lib/md035.js +0 -24
  220. package/packages/config-markdownlint/node_modules/markdownlint/lib/md036.js +0 -56
  221. package/packages/config-markdownlint/node_modules/markdownlint/lib/md037.js +0 -91
  222. package/packages/config-markdownlint/node_modules/markdownlint/lib/md038.js +0 -97
  223. package/packages/config-markdownlint/node_modules/markdownlint/lib/md039.js +0 -67
  224. package/packages/config-markdownlint/node_modules/markdownlint/lib/md040.js +0 -37
  225. package/packages/config-markdownlint/node_modules/markdownlint/lib/md041.js +0 -42
  226. package/packages/config-markdownlint/node_modules/markdownlint/lib/md042.js +0 -49
  227. package/packages/config-markdownlint/node_modules/markdownlint/lib/md043.js +0 -64
  228. package/packages/config-markdownlint/node_modules/markdownlint/lib/md044.js +0 -107
  229. package/packages/config-markdownlint/node_modules/markdownlint/lib/md045.js +0 -60
  230. package/packages/config-markdownlint/node_modules/markdownlint/lib/md046.js +0 -33
  231. package/packages/config-markdownlint/node_modules/markdownlint/lib/md047.js +0 -28
  232. package/packages/config-markdownlint/node_modules/markdownlint/lib/md048.js +0 -30
  233. package/packages/config-markdownlint/node_modules/markdownlint/lib/md049-md050.js +0 -89
  234. package/packages/config-markdownlint/node_modules/markdownlint/lib/md051.js +0 -172
  235. package/packages/config-markdownlint/node_modules/markdownlint/lib/md052.js +0 -39
  236. package/packages/config-markdownlint/node_modules/markdownlint/lib/md053.js +0 -59
  237. package/packages/config-markdownlint/node_modules/markdownlint/lib/md054.js +0 -125
  238. package/packages/config-markdownlint/node_modules/markdownlint/lib/rules.js +0 -65
  239. package/packages/config-markdownlint/node_modules/markdownlint/package.json +0 -109
  240. package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.jsonc +0 -297
  241. package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.yaml +0 -266
  242. package/packages/config-markdownlint/node_modules/markdownlint/schema/markdownlint-config-schema.json +0 -1762
  243. package/packages/config-markdownlint/node_modules/markdownlint/style/all.json +0 -5
  244. package/packages/config-markdownlint/node_modules/markdownlint/style/cirosantilli.json +0 -22
  245. package/packages/config-markdownlint/node_modules/markdownlint/style/prettier.json +0 -26
  246. package/packages/config-markdownlint/node_modules/markdownlint/style/relaxed.json +0 -12
  247. /package/packages/config-eslint/plugins/{security.js → optional/security.js} +0 -0
@@ -1,1026 +0,0 @@
1
- # markdownlint
2
-
3
- > A Node.js style checker and lint tool for Markdown/CommonMark files.
4
-
5
- [![npm version][npm-image]][npm-url]
6
- [![License][license-image]][license-url]
7
-
8
- ## Install
9
-
10
- ```bash
11
- npm install markdownlint --save-dev
12
- ```
13
-
14
- ## Overview
15
-
16
- The [Markdown](https://en.wikipedia.org/wiki/Markdown) markup language
17
- is designed to be easy to read, write, and understand. It succeeds -
18
- and its flexibility is both a benefit and a drawback. Many styles are
19
- possible, so formatting can be inconsistent. Some constructs don't
20
- work well in all parsers and should be avoided. The
21
- [CommonMark](https://commonmark.org/) specification standardizes
22
- parsers - but not authors.
23
-
24
- `markdownlint` is a
25
- [static analysis](https://en.wikipedia.org/wiki/Static_program_analysis)
26
- tool for [Node.js](https://nodejs.org/) with a library of rules
27
- to enforce standards and consistency for Markdown files. It was
28
- inspired by - and heavily influenced by - Mark Harrison's
29
- [markdownlint](https://github.com/markdownlint/markdownlint) for
30
- [Ruby](https://www.ruby-lang.org/). The initial rules, rule documentation,
31
- and test cases came directly from that project.
32
-
33
- ### Related
34
-
35
- - CLI
36
- - [markdownlint-cli][markdownlint-cli] command-line interface for Node.js
37
- ([works with pre-commit][markdownlint-cli-precommit])
38
- - [markdownlint-cli2][markdownlint-cli2] command-line interface for Node.js
39
- ([works with pre-commit][markdownlint-cli2-precommit])
40
- - GitHub
41
- - [GitHub Action for markdownlint-cli2][markdownlint-cli2-action]
42
- - [GitHub Super-Linter Action][super-linter]
43
- - [GitHub Actions problem matcher for
44
- markdownlint-cli][markdownlint-problem-matcher]
45
- - Editor
46
- - [vscode-markdownlint extension for VS Code][vscode-markdownlint]
47
- - [Sublime Text markdownlint for Sublime Text][sublimelinter]
48
- - [coc-markdownlint extension for Vim/Neovim][coc]
49
- - Tooling
50
- - [eslint-plugin-markdownlint for the ESLint analyzer][eslint-plugin]
51
- - [grunt-markdownlint for the Grunt task runner][grunt-markdownlint]
52
- - [Cake.Markdownlint addin for Cake build automation system][cake]
53
- - [Lombiq Node.js Extensions for MSBuild (.NET builds)][nodejs-extensions]
54
- - Ruby
55
- - [markdownlint/mdl gem for Ruby][rubygems-mdl]
56
-
57
- [cake]: https://github.com/cake-contrib/Cake.Markdownlint
58
- [coc]: https://github.com/fannheyward/coc-markdownlint
59
- [eslint-plugin]: https://github.com/paweldrozd/eslint-plugin-markdownlint
60
- [grunt-markdownlint]: https://github.com/sagiegurari/grunt-markdownlint
61
- [markdownlint-cli]: https://github.com/igorshubovych/markdownlint-cli
62
- [markdownlint-cli-precommit]: https://github.com/igorshubovych/markdownlint-cli#use-with-pre-commit
63
- [markdownlint-cli2]: https://github.com/DavidAnson/markdownlint-cli2
64
- [markdownlint-cli2-action]: https://github.com/marketplace/actions/markdownlint-cli2-action
65
- [markdownlint-cli2-precommit]: https://github.com/DavidAnson/markdownlint-cli2#pre-commit
66
- [markdownlint-problem-matcher]: https://github.com/xt0rted/markdownlint-problem-matcher
67
- [nodejs-extensions]: https://github.com/Lombiq/NodeJs-Extensions
68
- [rubygems-mdl]: https://rubygems.org/gems/mdl
69
- [sublimelinter]: https://packagecontrol.io/packages/SublimeLinter-contrib-markdownlint
70
- [super-linter]: https://github.com/super-linter/super-linter
71
- [vscode-markdownlint]: https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint
72
-
73
- ### References
74
-
75
- The following specifications are considered authoritative in cases of ambiguity:
76
-
77
- - [CommonMark](https://spec.commonmark.org/current/)
78
- - [GitHub Flavored Markdown Spec](https://github.github.com/gfm/)
79
-
80
- ## Demonstration
81
-
82
- [`markdownlint` demo](https://dlaa.me/markdownlint/), an interactive, in-browser
83
- playground for learning and exploring.
84
-
85
- ## Rules / Aliases
86
-
87
- <!-- markdownlint-disable line-length -->
88
-
89
- - **[MD001](doc/md001.md)** *heading-increment* - Heading levels should only increment by one level at a time
90
- - **[MD003](doc/md003.md)** *heading-style* - Heading style
91
- - **[MD004](doc/md004.md)** *ul-style* - Unordered list style
92
- - **[MD005](doc/md005.md)** *list-indent* - Inconsistent indentation for list items at the same level
93
- - **[MD007](doc/md007.md)** *ul-indent* - Unordered list indentation
94
- - **[MD009](doc/md009.md)** *no-trailing-spaces* - Trailing spaces
95
- - **[MD010](doc/md010.md)** *no-hard-tabs* - Hard tabs
96
- - **[MD011](doc/md011.md)** *no-reversed-links* - Reversed link syntax
97
- - **[MD012](doc/md012.md)** *no-multiple-blanks* - Multiple consecutive blank lines
98
- - **[MD013](doc/md013.md)** *line-length* - Line length
99
- - **[MD014](doc/md014.md)** *commands-show-output* - Dollar signs used before commands without showing output
100
- - **[MD018](doc/md018.md)** *no-missing-space-atx* - No space after hash on atx style heading
101
- - **[MD019](doc/md019.md)** *no-multiple-space-atx* - Multiple spaces after hash on atx style heading
102
- - **[MD020](doc/md020.md)** *no-missing-space-closed-atx* - No space inside hashes on closed atx style heading
103
- - **[MD021](doc/md021.md)** *no-multiple-space-closed-atx* - Multiple spaces inside hashes on closed atx style heading
104
- - **[MD022](doc/md022.md)** *blanks-around-headings* - Headings should be surrounded by blank lines
105
- - **[MD023](doc/md023.md)** *heading-start-left* - Headings must start at the beginning of the line
106
- - **[MD024](doc/md024.md)** *no-duplicate-heading* - Multiple headings with the same content
107
- - **[MD025](doc/md025.md)** *single-title/single-h1* - Multiple top-level headings in the same document
108
- - **[MD026](doc/md026.md)** *no-trailing-punctuation* - Trailing punctuation in heading
109
- - **[MD027](doc/md027.md)** *no-multiple-space-blockquote* - Multiple spaces after blockquote symbol
110
- - **[MD028](doc/md028.md)** *no-blanks-blockquote* - Blank line inside blockquote
111
- - **[MD029](doc/md029.md)** *ol-prefix* - Ordered list item prefix
112
- - **[MD030](doc/md030.md)** *list-marker-space* - Spaces after list markers
113
- - **[MD031](doc/md031.md)** *blanks-around-fences* - Fenced code blocks should be surrounded by blank lines
114
- - **[MD032](doc/md032.md)** *blanks-around-lists* - Lists should be surrounded by blank lines
115
- - **[MD033](doc/md033.md)** *no-inline-html* - Inline HTML
116
- - **[MD034](doc/md034.md)** *no-bare-urls* - Bare URL used
117
- - **[MD035](doc/md035.md)** *hr-style* - Horizontal rule style
118
- - **[MD036](doc/md036.md)** *no-emphasis-as-heading* - Emphasis used instead of a heading
119
- - **[MD037](doc/md037.md)** *no-space-in-emphasis* - Spaces inside emphasis markers
120
- - **[MD038](doc/md038.md)** *no-space-in-code* - Spaces inside code span elements
121
- - **[MD039](doc/md039.md)** *no-space-in-links* - Spaces inside link text
122
- - **[MD040](doc/md040.md)** *fenced-code-language* - Fenced code blocks should have a language specified
123
- - **[MD041](doc/md041.md)** *first-line-heading/first-line-h1* - First line in a file should be a top-level heading
124
- - **[MD042](doc/md042.md)** *no-empty-links* - No empty links
125
- - **[MD043](doc/md043.md)** *required-headings* - Required heading structure
126
- - **[MD044](doc/md044.md)** *proper-names* - Proper names should have the correct capitalization
127
- - **[MD045](doc/md045.md)** *no-alt-text* - Images should have alternate text (alt text)
128
- - **[MD046](doc/md046.md)** *code-block-style* - Code block style
129
- - **[MD047](doc/md047.md)** *single-trailing-newline* - Files should end with a single newline character
130
- - **[MD048](doc/md048.md)** *code-fence-style* - Code fence style
131
- - **[MD049](doc/md049.md)** *emphasis-style* - Emphasis style
132
- - **[MD050](doc/md050.md)** *strong-style* - Strong style
133
- - **[MD051](doc/md051.md)** *link-fragments* - Link fragments should be valid
134
- - **[MD052](doc/md052.md)** *reference-links-images* - Reference links and images should use a label that is defined
135
- - **[MD053](doc/md053.md)** *link-image-reference-definitions* - Link and image reference definitions should be needed
136
- - **[MD054](doc/md054.md)** *link-image-style* - Link and image style
137
-
138
- <!-- markdownlint-restore -->
139
-
140
- See [Rules.md](doc/Rules.md) for more details.
141
-
142
- ### Custom Rules
143
-
144
- In addition to built-in rules, custom rules can be used to address
145
- project-specific requirements. To find community-developed rules use
146
- [keyword `markdownlint-rule` on npm][markdownlint-rule].
147
- To implement your own rules, refer to [CustomRules.md](doc/CustomRules.md).
148
-
149
- [markdownlint-rule]: https://www.npmjs.com/search?q=keywords:markdownlint-rule
150
-
151
- ## Tags
152
-
153
- Tags group related rules and can be used to enable/disable multiple
154
- rules at once.
155
-
156
- - **`accessibility`** - `MD045`
157
- - **`atx`** - `MD018`, `MD019`
158
- - **`atx_closed`** - `MD020`, `MD021`
159
- - **`blank_lines`** - `MD012`, `MD022`, `MD031`, `MD032`, `MD047`
160
- - **`blockquote`** - `MD027`, `MD028`
161
- - **`bullet`** - `MD004`, `MD005`, `MD007`, `MD032`
162
- - **`code`** - `MD014`, `MD031`, `MD038`, `MD040`, `MD046`, `MD048`
163
- - **`emphasis`** - `MD036`, `MD037`, `MD049`, `MD050`
164
- - **`hard_tab`** - `MD010`
165
- - **`headings`** - `MD001`, `MD003`, `MD018`, `MD019`, `MD020`, `MD021`,
166
- `MD022`, `MD023`, `MD024`, `MD025`, `MD026`, `MD036`, `MD041`, `MD043`
167
- - **`hr`** - `MD035`
168
- - **`html`** - `MD033`
169
- - **`images`** - `MD045`, `MD052`, `MD053`, `MD054`
170
- - **`indentation`** - `MD005`, `MD007`, `MD027`
171
- - **`language`** - `MD040`
172
- - **`line_length`** - `MD013`
173
- - **`links`** - `MD011`, `MD034`, `MD039`, `MD042`, `MD051`, `MD052`, `MD053`,
174
- `MD054`
175
- - **`ol`** - `MD029`, `MD030`, `MD032`
176
- - **`spaces`** - `MD018`, `MD019`, `MD020`, `MD021`, `MD023`
177
- - **`spelling`** - `MD044`
178
- - **`ul`** - `MD004`, `MD005`, `MD007`, `MD030`, `MD032`
179
- - **`url`** - `MD034`
180
- - **`whitespace`** - `MD009`, `MD010`, `MD012`, `MD027`, `MD028`, `MD030`,
181
- `MD037`, `MD038`, `MD039`
182
-
183
- ## Configuration
184
-
185
- Text passed to `markdownlint` is parsed as Markdown, analyzed, and any
186
- issues reported. Two kinds of text are ignored by most rules:
187
-
188
- - [HTML comments](https://www.w3.org/TR/html5/syntax.html#comments)
189
- - [Front matter](https://jekyllrb.com/docs/frontmatter/) (see
190
- `options.frontMatter` below)
191
-
192
- Rules can be enabled, disabled, and configured via `options.config`
193
- (described below) to define the expected behavior for a set of inputs.
194
- To enable or disable rules at a particular location within a file, add
195
- one of these markers to the appropriate place (HTML comments don't
196
- appear in the final markup):
197
-
198
- - Disable all rules: `<!-- markdownlint-disable -->`
199
- - Enable all rules: `<!-- markdownlint-enable -->`
200
- - Disable all rules for the current line: `<!-- markdownlint-disable-line -->`
201
- - Disable all rules for the next line: `<!-- markdownlint-disable-next-line -->`
202
- - Disable one or more rules by name: `<!-- markdownlint-disable MD001 MD005 -->`
203
- - Enable one or more rules by name: `<!-- markdownlint-enable MD001 MD005 -->`
204
- - Disable one or more rules by name for the current line:
205
- `<!-- markdownlint-disable-line MD001 MD005 -->`
206
- - Disable one or more rules by name for the next line:
207
- `<!-- markdownlint-disable-next-line MD001 MD005 -->`
208
- - Capture the current rule configuration: `<!-- markdownlint-capture -->`
209
- - Restore the captured rule configuration: `<!-- markdownlint-restore -->`
210
-
211
- For example:
212
-
213
- ```markdown
214
- <!-- markdownlint-disable-next-line no-space-in-emphasis -->
215
- space * in * emphasis
216
- ```
217
-
218
- Or:
219
-
220
- ```markdown
221
- space * in * emphasis <!-- markdownlint-disable-line no-space-in-emphasis -->
222
- ```
223
-
224
- Or:
225
-
226
- ```markdown
227
- <!-- markdownlint-disable no-space-in-emphasis -->
228
- space * in * emphasis
229
- <!-- markdownlint-enable no-space-in-emphasis -->
230
- ```
231
-
232
- To temporarily disable rule(s), then restore the former configuration:
233
-
234
- ```markdown
235
- <!-- markdownlint-capture -->
236
- <!-- markdownlint-disable -->
237
- any violations you want
238
- <!-- markdownlint-restore -->
239
- ```
240
-
241
- The initial configuration is captured by default (as if every document
242
- began with `<!-- markdownlint-capture -->`), so the pattern above can
243
- be expressed more simply:
244
-
245
- ```markdown
246
- <!-- markdownlint-disable -->
247
- any violations you want
248
- <!-- markdownlint-restore -->
249
- ```
250
-
251
- Changes take effect starting with the line a comment is on, so the following
252
- has no effect:
253
-
254
- ```markdown
255
- space * in * emphasis <!-- markdownlint-disable --> <!-- markdownlint-enable -->
256
- ```
257
-
258
- To apply changes to an entire file regardless of where the comment is located,
259
- the following syntax is supported:
260
-
261
- - Disable all rules: `<!-- markdownlint-disable-file -->`
262
- - Enable all rules: `<!-- markdownlint-enable-file -->`
263
- - Disable one or more rules by name: `<!-- markdownlint-disable-file MD001 -->`
264
- - Enable one or more rules by name: `<!-- markdownlint-enable-file MD001 -->`
265
-
266
- This can be used to "hide" `markdownlint` comments at the bottom of a file.
267
-
268
- In cases where it is desirable to change the configuration of one or
269
- more rules for a file, the following more advanced syntax is supported:
270
-
271
- - Configure: `<!-- markdownlint-configure-file { options.config JSON } -->`
272
-
273
- For example:
274
-
275
- ```markdown
276
- <!-- markdownlint-configure-file { "hr-style": { "style": "---" } } -->
277
- ```
278
-
279
- or
280
-
281
- ```markdown
282
- <!-- markdownlint-configure-file
283
- {
284
- "hr-style": {
285
- "style": "---"
286
- },
287
- "no-trailing-spaces": false
288
- }
289
- -->
290
- ```
291
-
292
- These changes apply to the entire file regardless of where the comment is
293
- located. Multiple such comments (if present) are applied top-to-bottom. By
294
- default, content of `markdownlint-configure-file` is assumed to be JSON, but
295
- [`options.configParsers`](#optionsconfigparsers) can be used to support
296
- alternate formats.
297
-
298
- ## API
299
-
300
- ### Linting
301
-
302
- Standard asynchronous API:
303
-
304
- ```javascript
305
- /**
306
- * Lint specified Markdown files.
307
- *
308
- * @param {Options} options Configuration options.
309
- * @param {LintCallback} callback Callback (err, result) function.
310
- * @returns {void}
311
- */
312
- function markdownlint(options, callback) { ... }
313
- ```
314
-
315
- Synchronous API (for build scripts, etc.):
316
-
317
- ```javascript
318
- /**
319
- * Lint specified Markdown files synchronously.
320
- *
321
- * @param {Options} options Configuration options.
322
- * @returns {LintResults} Results object.
323
- */
324
- function markdownlint.sync(options) { ... }
325
- ```
326
-
327
- Promise API (in the `promises` namespace like Node.js's
328
- [`fs` Promises API](https://nodejs.org/api/fs.html#fs_fs_promises_api)):
329
-
330
- ```javascript
331
- /**
332
- * Lint specified Markdown files.
333
- *
334
- * @param {Options} options Configuration options.
335
- * @returns {Promise<LintResults>} Results object.
336
- */
337
- function markdownlint(options) { ... }
338
- ```
339
-
340
- #### options
341
-
342
- Type: `Object`
343
-
344
- Configures the function. All properties are optional, but at least one
345
- of `files` or `strings` should be set to provide input.
346
-
347
- ##### options.config
348
-
349
- Type: `Object` mapping `String` to `Boolean | Object`
350
-
351
- Configures the rules to use.
352
-
353
- Object keys are rule names or aliases and values are the rule's configuration.
354
- The value `false` disables a rule, `true` enables its default configuration,
355
- and passing an object customizes its settings. Setting the special `default`
356
- rule to `true` or `false` includes/excludes all rules by default. Enabling
357
- or disabling a tag name (ex: `whitespace`) affects all rules having that
358
- tag.
359
-
360
- The `default` rule is applied first, then keys are processed in order
361
- from top to bottom with later values overriding earlier ones. Keys
362
- (including rule names, aliases, tags, and `default`) are not case-sensitive.
363
-
364
- Example:
365
-
366
- ```json
367
- {
368
- "default": true,
369
- "MD003": { "style": "atx_closed" },
370
- "MD007": { "indent": 4 },
371
- "no-hard-tabs": false,
372
- "whitespace": false
373
- }
374
- ```
375
-
376
- See [.markdownlint.jsonc](schema/.markdownlint.jsonc) and/or
377
- [.markdownlint.yaml](schema/.markdownlint.yaml) for an example
378
- configuration object with all properties set to the default value.
379
-
380
- Sets of rules (known as a "style") can be stored separately and loaded
381
- as [JSON](https://en.wikipedia.org/wiki/JSON).
382
-
383
- Example of referencing a built-in style from JavaScript:
384
-
385
- ```javascript
386
- const options = {
387
- "files": [ "..." ],
388
- "config": require("style/relaxed.json")
389
- };
390
- ```
391
-
392
- Example doing so from `.markdownlint.json` via `extends` (more on this below):
393
-
394
- ```json
395
- {
396
- "extends": "markdownlint/style/relaxed"
397
- }
398
- ```
399
-
400
- See the [style](style) directory for more samples.
401
-
402
- See [markdownlint-config-schema.json](schema/markdownlint-config-schema.json)
403
- for the [JSON Schema](https://json-schema.org/) of the `options.config`
404
- object.
405
-
406
- For more advanced scenarios, styles can reference and extend other styles.
407
- The `readConfig` and `readConfigSync` functions can be used to read such
408
- styles.
409
-
410
- For example, assuming a `base.json` configuration file:
411
-
412
- ```json
413
- {
414
- "default": true
415
- }
416
- ```
417
-
418
- And a `custom.json` configuration file:
419
-
420
- ```json
421
- {
422
- "extends": "base.json",
423
- "line-length": false
424
- }
425
- ```
426
-
427
- Then code like the following:
428
-
429
- ```javascript
430
- const options = {
431
- "config": markdownlint.readConfigSync("./custom.json")
432
- };
433
- ```
434
-
435
- Merges `custom.json` and `base.json` and is equivalent to:
436
-
437
- ```javascript
438
- const options = {
439
- "config": {
440
- "default": true,
441
- "line-length": false
442
- }
443
- };
444
- ```
445
-
446
- ##### options.configParsers
447
-
448
- Type: *Optional* `Array` of `Function` taking (`String`) and returning `Object`
449
-
450
- Array of functions to parse the content of `markdownlint-configure-file` blocks.
451
-
452
- As shown in the [Configuration](#configuration) section, inline comments can be
453
- used to customize the [configuration object](#optionsconfig) for a document. By
454
- default, the `JSON.parse` built-in is used, but custom parsers can be specified.
455
- Content is passed to each parser function until one returns a value (vs.
456
- throwing an exception). As such, strict parsers should come before flexible
457
- ones.
458
-
459
- For example:
460
-
461
- ```javascript
462
- [ JSON.parse, require("toml").parse, require("js-yaml").load ]
463
- ```
464
-
465
- ##### options.customRules
466
-
467
- Type: `Array` of `Object`
468
-
469
- List of custom rules to include with the default rule set for linting.
470
-
471
- Each array element should define a rule. Rules are typically exported
472
- by another package, but can be defined locally.
473
-
474
- Example:
475
-
476
- ```javascript
477
- const extraRules = require("extraRules");
478
- const options = {
479
- "customRules": [ extraRules.one, extraRules.two ]
480
- };
481
- ```
482
-
483
- See [CustomRules.md](doc/CustomRules.md) for details about authoring
484
- custom rules.
485
-
486
- ##### options.files
487
-
488
- Type: `Array` of `String`
489
-
490
- List of files to lint.
491
-
492
- Each array element should be a single file (via relative or absolute path);
493
- [globbing](https://en.wikipedia.org/wiki/Glob_%28programming%29) is the
494
- caller's responsibility.
495
-
496
- Example: `[ "one.md", "dir/two.md" ]`
497
-
498
- ##### options.frontMatter
499
-
500
- Type: `RegExp`
501
-
502
- Matches any [front matter](https://jekyllrb.com/docs/frontmatter/)
503
- found at the beginning of a file.
504
-
505
- Some Markdown content begins with metadata; the default `RegExp` for
506
- this option ignores common forms of "front matter". To match differently,
507
- specify a custom `RegExp` or use the value `null` to disable the feature.
508
-
509
- The default value:
510
-
511
- ```javascript
512
- /((^---\s*$[\s\S]+?^---\s*)|(^\+\+\+\s*$[\s\S]+?^(\+\+\+|\.\.\.)\s*)|(^\{\s*$[\s\S]+?^\}\s*))(\r\n|\r|\n|$)/m
513
- ```
514
-
515
- Ignores [YAML](https://en.wikipedia.org/wiki/YAML),
516
- [TOML](https://en.wikipedia.org/wiki/TOML), and
517
- [JSON](https://en.wikipedia.org/wiki/JSON) front matter such as:
518
-
519
- ```text
520
- ---
521
- layout: post
522
- title: Title
523
- ---
524
- ```
525
-
526
- Note: Matches must occur at the start of the file.
527
-
528
- ##### options.fs
529
-
530
- Type: `Object` implementing the [file system API][node-fs-api]
531
-
532
- In advanced scenarios, it may be desirable to bypass the default file system
533
- API. If a custom file system implementation is provided, `markdownlint` will use
534
- that instead of invoking `require("fs")`.
535
-
536
- Note: The only methods called are `readFile` and `readFileSync`.
537
-
538
- [node-fs-api]: https://nodejs.org/api/fs.html
539
-
540
- ##### options.handleRuleFailures
541
-
542
- Type: `Boolean`
543
-
544
- Catches exceptions thrown during rule processing and reports the problem
545
- as a rule violation.
546
-
547
- By default, exceptions thrown by rules (or the library itself) are unhandled
548
- and bubble up the stack to the caller in the conventional manner. By setting
549
- `handleRuleFailures` to `true`, exceptions thrown by failing rules will
550
- be handled by the library and the exception message logged as a rule violation.
551
- This setting can be useful in the presence of (custom) rules that encounter
552
- unexpected syntax and fail. By enabling this option, the linting process
553
- is allowed to continue and report any violations that were found.
554
-
555
- ##### options.markdownItPlugins
556
-
557
- Type: `Array` of `Array` of `Function` and plugin parameters
558
-
559
- Specifies additional [markdown-it plugins][markdown-it-plugin] to use when
560
- parsing input. Plugins can be used to support additional syntax and features for
561
- advanced scenarios.
562
-
563
- [markdown-it-plugin]: https://www.npmjs.com/search?q=keywords:markdown-it-plugin
564
-
565
- Each item in the top-level `Array` should be of the form:
566
-
567
- ```javascript
568
- [ require("markdown-it-plugin"), plugin_param_0, plugin_param_1, ... ]
569
- ```
570
-
571
- ##### options.noInlineConfig
572
-
573
- Type: `Boolean`
574
-
575
- Disables the use of HTML comments like `<!-- markdownlint-enable -->` to toggle
576
- rules within the body of Markdown content.
577
-
578
- By default, properly-formatted inline comments can be used to create exceptions
579
- for parts of a document. Setting `noInlineConfig` to `true` ignores all such
580
- comments.
581
-
582
- ##### options.resultVersion
583
-
584
- Type: `Number`
585
-
586
- Specifies which version of the `result` object to return (see the "Usage"
587
- section below for examples).
588
-
589
- Passing a `resultVersion` of `0` corresponds to the original, simple format
590
- where each error is identified by rule name and line number. *This is
591
- deprecated.*
592
-
593
- Passing a `resultVersion` of `1` corresponds to a detailed format where each
594
- error includes information about the line number, rule name, alias, description,
595
- as well as any additional detail or context that is available. *This is
596
- deprecated.*
597
-
598
- Passing a `resultVersion` of `2` corresponds to a detailed format where each
599
- error includes information about the line number, rule names, description, as
600
- well as any additional detail or context that is available. *This is
601
- deprecated.*
602
-
603
- Passing a `resultVersion` of `3` corresponds to the detailed version `2` format
604
- with additional information about how to fix automatically-fixable errors. In
605
- this mode, all errors that occur on each line are reported (other versions
606
- report only the first error for each rule). *This is the default.*
607
-
608
- ##### options.strings
609
-
610
- Type: `Object` mapping `String` to `String`
611
-
612
- Map of identifiers to strings for linting.
613
-
614
- When Markdown content is not available as files, it can be passed as
615
- strings. The keys of the `strings` object are used to identify each
616
- input value in the `result` summary.
617
-
618
- Example:
619
-
620
- ```json
621
- {
622
- "readme": "# README\n...",
623
- "changelog": "# CHANGELOG\n..."
624
- }
625
- ```
626
-
627
- #### callback
628
-
629
- Type: `Function` taking (`Error`, `Object`)
630
-
631
- Standard completion callback.
632
-
633
- #### result
634
-
635
- Type: `Object`
636
-
637
- Call `result.toString()` for convenience or see below for an example of the
638
- structure of the `result` object. Passing the value `true` to `toString()`
639
- uses rule aliases (ex: `no-hard-tabs`) instead of names (ex: `MD010`).
640
-
641
- ### Config
642
-
643
- The `options.config` configuration object is simple and can be stored in a file
644
- for readability and easy reuse. The `readConfig` and `readConfigSync` functions
645
- load configuration settings and support the `extends` keyword for referencing
646
- other files (see above).
647
-
648
- By default, configuration files are parsed as JSON (and named
649
- `.markdownlint.json`). Custom parsers can be provided to handle other formats
650
- like JSONC, YAML, and TOML.
651
-
652
- Asynchronous API:
653
-
654
- ```javascript
655
- /**
656
- * Read specified configuration file.
657
- *
658
- * @param {string} file Configuration file name.
659
- * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing function.
660
- * @param {Object} [fs] File system implementation.
661
- * @param {ReadConfigCallback} [callback] Callback (err, result) function.
662
- * @returns {void}
663
- */
664
- function readConfig(file, parsers, fs, callback) { ... }
665
- ```
666
-
667
- Synchronous API:
668
-
669
- ```javascript
670
- /**
671
- * Read specified configuration file synchronously.
672
- *
673
- * @param {string} file Configuration file name.
674
- * @param {ConfigurationParser[]} [parsers] Parsing function(s).
675
- * @param {Object} [fs] File system implementation.
676
- * @returns {Configuration} Configuration object.
677
- */
678
- function readConfigSync(file, parsers, fs) { ... }
679
- ```
680
-
681
- Promise API (in the `promises` namespace like Node.js's
682
- [`fs` Promises API](https://nodejs.org/api/fs.html#fs_promises_api)):
683
-
684
- ```javascript
685
- /**
686
- * Read specified configuration file.
687
- *
688
- * @param {string} file Configuration file name.
689
- * @param {ConfigurationParser[]} [parsers] Parsing function(s).
690
- * @param {Object} [fs] File system implementation.
691
- * @returns {Promise<Configuration>} Configuration object.
692
- */
693
- function readConfig(file, parsers, fs) { ... }
694
- ```
695
-
696
- #### file
697
-
698
- Type: `String`
699
-
700
- Location of configuration file to read.
701
-
702
- The `file` is resolved relative to the current working directory. If an
703
- `extends` key is present once read, its value will be resolved as a path
704
- relative to `file` and loaded recursively. Settings from a file referenced by
705
- `extends` are applied first, then those of `file` are applied on top (overriding
706
- any of the same keys appearing in the referenced file). If either the `file` or
707
- `extends` path begins with the `~` directory, it will act as a placeholder for
708
- the home directory.
709
-
710
- #### parsers
711
-
712
- Type: *Optional* `Array` of `Function` taking (`String`) and returning `Object`
713
-
714
- Array of functions to parse configuration files.
715
-
716
- The contents of a configuration file are passed to each parser function until
717
- one of them returns a value (vs. throwing an exception). Consequently, strict
718
- parsers should come before flexible parsers.
719
-
720
- For example:
721
-
722
- ```javascript
723
- [ JSON.parse, require("toml").parse, require("js-yaml").load ]
724
- ```
725
-
726
- #### fs
727
-
728
- Type: *Optional* `Object` implementing the [file system API][file-system-api]
729
-
730
- [file-system-api]: https://nodejs.org/api/fs.html
731
-
732
- In advanced scenarios, it may be desirable to bypass the default file system
733
- API. If a custom file system implementation is provided, `markdownlint` will use
734
- that instead of invoking `require("fs")`.
735
-
736
- Note: The only methods called are `readFile`, `readFileSync`, `access`, and
737
- `accessSync`.
738
-
739
- #### callback
740
-
741
- Type: `Function` taking (`Error`, `Object`)
742
-
743
- Standard completion callback.
744
-
745
- #### result
746
-
747
- Type: `Object`
748
-
749
- Configuration object.
750
-
751
- ## Usage
752
-
753
- Invoke `markdownlint` and use the `result` object's `toString` method:
754
-
755
- ```javascript
756
- const markdownlint = require("markdownlint");
757
-
758
- const options = {
759
- "files": [ "good.md", "bad.md" ],
760
- "strings": {
761
- "good.string": "# good.string\n\nThis string passes all rules.",
762
- "bad.string": "#bad.string\n\n#This string fails\tsome rules."
763
- }
764
- };
765
-
766
- markdownlint(options, function callback(err, result) {
767
- if (!err) {
768
- console.log(result.toString());
769
- }
770
- });
771
- ```
772
-
773
- Output:
774
-
775
- ```text
776
- bad.string: 3: MD010/no-hard-tabs Hard tabs [Column: 19]
777
- bad.string: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.string"]
778
- bad.string: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This string fails some rules."]
779
- bad.string: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.string"]
780
- bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
781
- bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
782
- bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
783
- bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
784
- ```
785
-
786
- Or invoke `markdownlint.sync` for a synchronous call:
787
-
788
- ```javascript
789
- const result = markdownlint.sync(options);
790
- console.log(result.toString());
791
- ```
792
-
793
- To examine the `result` object directly:
794
-
795
- ```javascript
796
- markdownlint(options, function callback(err, result) {
797
- if (!err) {
798
- console.dir(result, { "colors": true, "depth": null });
799
- }
800
- });
801
- ```
802
-
803
- Output:
804
-
805
- ```json
806
- {
807
- "good.md": [],
808
- "bad.md": [
809
- { "lineNumber": 3,
810
- "ruleNames": [ "MD010", "no-hard-tabs" ],
811
- "ruleDescription": "Hard tabs",
812
- "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md010.md",
813
- "errorDetail": "Column: 17",
814
- "errorContext": null,
815
- "errorRange": [ 17, 1 ] },
816
- { "lineNumber": 1,
817
- "ruleNames": [ "MD018", "no-missing-space-atx" ],
818
- "ruleDescription": "No space after hash on atx style heading",
819
- "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md018.md",
820
- "errorDetail": null,
821
- "errorContext": "#bad.md",
822
- "errorRange": [ 1, 2 ] },
823
- { "lineNumber": 3,
824
- "ruleNames": [ "MD018", "no-missing-space-atx" ],
825
- "ruleDescription": "No space after hash on atx style heading",
826
- "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md018.md",
827
- "errorDetail": null,
828
- "errorContext": "#This file fails\tsome rules.",
829
- "errorRange": [ 1, 2 ] },
830
- { "lineNumber": 1,
831
- "ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
832
- "ruleDescription": "First line in a file should be a top-level heading",
833
- "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md041.md",
834
- "errorDetail": null,
835
- "errorContext": "#bad.md",
836
- "errorRange": null }
837
- ]
838
- }
839
- ```
840
-
841
- Integration with the [gulp](https://gulpjs.com/) build system is
842
- straightforward:
843
-
844
- ```javascript
845
- const gulp = require("gulp");
846
- const through2 = require("through2");
847
- const markdownlint = require("markdownlint");
848
-
849
- gulp.task("markdownlint", function task() {
850
- return gulp.src("*.md", { "read": false })
851
- .pipe(through2.obj(function obj(file, enc, next) {
852
- markdownlint(
853
- { "files": [ file.relative ] },
854
- function callback(err, result) {
855
- const resultString = (result || "").toString();
856
- if (resultString) {
857
- console.log(resultString);
858
- }
859
- next(err, file);
860
- });
861
- }));
862
- });
863
- ```
864
-
865
- Output:
866
-
867
- ```text
868
- [00:00:00] Starting 'markdownlint'...
869
- bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
870
- bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
871
- bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
872
- bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
873
- [00:00:00] Finished 'markdownlint' after 10 ms
874
- ```
875
-
876
- Integration with the [Grunt](https://gruntjs.com/) build system is similar:
877
-
878
- ```javascript
879
- const markdownlint = require("markdownlint");
880
-
881
- module.exports = function wrapper(grunt) {
882
- grunt.initConfig({
883
- "markdownlint": {
884
- "example": {
885
- "src": [ "*.md" ]
886
- }
887
- }
888
- });
889
-
890
- grunt.registerMultiTask("markdownlint", function task() {
891
- const done = this.async();
892
- markdownlint(
893
- { "files": this.filesSrc },
894
- function callback(err, result) {
895
- const resultString = err || ((result || "").toString());
896
- if (resultString) {
897
- grunt.fail.warn("\n" + resultString + "\n");
898
- }
899
- done(!err || !resultString);
900
- });
901
- });
902
- };
903
- ```
904
-
905
- Output:
906
-
907
- ```text
908
- Running "markdownlint:example" (markdownlint) task
909
- Warning:
910
- bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
911
- bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
912
- bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
913
- bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
914
- Use --force to continue.
915
- ```
916
-
917
- ### Fixing
918
-
919
- Rules that can be fixed automatically include a `fixInfo` property which is
920
- outlined in the [documentation for custom rules](doc/CustomRules.md#authoring).
921
- To apply those fixes more easily, the `applyFixes` method in
922
- [markdownlint-rule-helpers](helpers/README.md#applying-recommended-fixes) may
923
- be used.
924
-
925
- ## Browser
926
-
927
- `markdownlint` also works in the browser.
928
-
929
- Generate normal and minified scripts with:
930
-
931
- ```bash
932
- npm run build-demo
933
- ```
934
-
935
- Then reference `markdown-it` and `markdownlint`:
936
-
937
- ```html
938
- <script src="demo/markdown-it.min.js"></script>
939
- <script src="demo/markdownlint-browser.min.js"></script>
940
- ```
941
-
942
- And call it like so:
943
-
944
- ```javascript
945
- const options = {
946
- "strings": {
947
- "content": "Some Markdown to lint."
948
- }
949
- };
950
- const results = window.markdownlint.sync(options).toString();
951
- ```
952
-
953
- ## Examples
954
-
955
- For ideas how to integrate `markdownlint` into your workflow, refer to the
956
- following projects or one of the tools in the [Related section](#related):
957
-
958
- - [.NET Documentation][dot-net-doc] ([Search repository][dot-net-doc-search])
959
- - [ally.js][ally-js] ([Search repository][ally-js-search])
960
- - [Apache Airflow][airflow] ([Search repository][airflow-search])
961
- - [Boostnote][boostnote] ([Search repository][boostnote-search])
962
- - [CodiMD][codimd] ([Search repository][codimd-search])
963
- - [Electron][electron] ([Search repository][electron-search])
964
- - [ESLint][eslint] ([Search repository][eslint-search])
965
- - [Garden React Components][garden] ([Search repository][garden-search])
966
- - [MDN Web Docs][mdn] ([Search repository][mdn-search])
967
- - [MkDocs][mkdocs] ([Search repository][mkdocs-search])
968
- - [Mocha][mocha] ([Search repository][mocha-search])
969
- - [Pi-hole documentation][pi-hole] ([Search repository][pi-hole-search])
970
- - [Reactable][reactable] ([Search repository][reactable-search])
971
- - [V8][v8] ([Search repository][v8-search])
972
- - [webhint][webhint] ([Search repository][webhint-search])
973
- - [webpack][webpack] ([Search repository][webpack-search])
974
- - [WordPress][wordpress] ([Search repository][wordpress-search])
975
-
976
- [ally-js]: https://allyjs.io/
977
- [ally-js-search]: https://github.com/medialize/ally.js/search?q=markdownlint
978
- [airflow]: https://airflow.apache.org
979
- [airflow-search]: https://github.com/apache/airflow/search?q=markdownlint
980
- [boostnote]: https://boostnote.io/
981
- [boostnote-search]: https://github.com/BoostIO/Boostnote/search?q=markdownlint
982
- [codimd]: https://github.com/hackmdio/codimd
983
- [codimd-search]: https://github.com/hackmdio/codimd/search?q=markdownlint
984
- [dot-net-doc]: https://docs.microsoft.com/en-us/dotnet/
985
- [dot-net-doc-search]: https://github.com/dotnet/docs/search?q=markdownlint
986
- [electron]: https://www.electronjs.org
987
- [electron-search]: https://github.com/electron/electron/search?q=markdownlint
988
- [eslint]: https://eslint.org/
989
- [eslint-search]: https://github.com/eslint/eslint/search?q=markdownlint
990
- [garden]: https://zendeskgarden.github.io/react-components/
991
- [garden-search]: https://github.com/zendeskgarden/react-components/search?q=markdownlint
992
- [mdn]: https://developer.mozilla.org/
993
- [mdn-search]: https://github.com/mdn/content/search?q=markdownlint
994
- [mkdocs]: https://www.mkdocs.org/
995
- [mkdocs-search]: https://github.com/mkdocs/mkdocs/search?q=markdownlint
996
- [mocha]: https://mochajs.org/
997
- [mocha-search]: https://github.com/mochajs/mocha/search?q=markdownlint
998
- [pi-hole]: https://docs.pi-hole.net
999
- [pi-hole-search]: https://github.com/pi-hole/docs/search?q=markdownlint
1000
- [reactable]: https://glittershark.github.io/reactable/
1001
- [reactable-search]: https://github.com/glittershark/reactable/search?q=markdownlint
1002
- [v8]: https://v8.dev/
1003
- [v8-search]: https://github.com/v8/v8.dev/search?q=markdownlint
1004
- [webhint]: https://webhint.io/
1005
- [webhint-search]: https://github.com/webhintio/hint/search?q=markdownlint
1006
- [webpack]: https://webpack.js.org/
1007
- [webpack-search]: https://github.com/webpack/webpack.js.org/search?q=markdownlint
1008
- [wordpress]: https://wordpress.org/gutenberg/
1009
- [wordpress-search]: https://github.com/WordPress/gutenberg/search?q=markdownlint
1010
-
1011
- ## Contributing
1012
-
1013
- See [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
1014
-
1015
- ## Releasing
1016
-
1017
- See [ReleaseProcess.md](doc/ReleaseProcess.md) for more information.
1018
-
1019
- ## History
1020
-
1021
- See [CHANGELOG.md](CHANGELOG.md).
1022
-
1023
- [npm-image]: https://img.shields.io/npm/v/markdownlint.svg
1024
- [npm-url]: https://www.npmjs.com/package/markdownlint
1025
- [license-image]: https://img.shields.io/npm/l/markdownlint.svg
1026
- [license-url]: https://opensource.org/licenses/MIT