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