markdownlint 0.12.0 → 0.14.2
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.
- package/.eslintrc.json +52 -275
- package/.travis.yml +2 -2
- package/LICENSE +1 -1
- package/README.md +54 -27
- package/doc/CustomRules.md +7 -2
- package/doc/Rules.md +120 -33
- package/example/standalone.js +2 -2
- package/helpers/LICENSE +21 -0
- package/helpers/README.md +50 -0
- package/{lib/shared.js → helpers/helpers.js} +91 -82
- package/helpers/package.json +18 -0
- package/lib/cache.js +24 -0
- package/lib/markdownlint.js +78 -45
- package/lib/md001.js +3 -3
- package/lib/md002.js +2 -2
- package/lib/md003.js +5 -4
- package/lib/md004.js +11 -9
- package/lib/md005.js +12 -10
- package/lib/md006.js +7 -5
- package/lib/md007.js +7 -5
- package/lib/md009.js +10 -8
- package/lib/md010.js +5 -5
- package/lib/md011.js +4 -4
- package/lib/md012.js +4 -3
- package/lib/md013.js +41 -32
- package/lib/md014.js +7 -6
- package/lib/md018.js +6 -4
- package/lib/md019.js +6 -5
- package/lib/md020.js +5 -4
- package/lib/md021.js +6 -5
- package/lib/md022.js +22 -22
- package/lib/md023.js +5 -4
- package/lib/md024.js +6 -6
- package/lib/md025.js +11 -5
- package/lib/md026.js +4 -4
- package/lib/md027.js +6 -6
- package/lib/md028.js +2 -2
- package/lib/md029.js +17 -9
- package/lib/md030.js +8 -6
- package/lib/md031.js +7 -6
- package/lib/md032.js +10 -12
- package/lib/md033.js +27 -26
- package/lib/md034.js +15 -10
- package/lib/md035.js +3 -3
- package/lib/md036.js +2 -2
- package/lib/md037.js +12 -9
- package/lib/md038.js +6 -5
- package/lib/md039.js +7 -6
- package/lib/md040.js +3 -3
- package/lib/md041.js +17 -19
- package/lib/md042.js +5 -4
- package/lib/md043.js +5 -4
- package/lib/md044.js +14 -13
- package/lib/md045.js +3 -3
- package/lib/md046.js +32 -0
- package/lib/md047.js +18 -0
- package/lib/rules.js +3 -1
- package/package.json +12 -11
- package/schema/build-config-schema.js +36 -2
- package/schema/markdownlint-config-schema.json +178 -14
- package/style/cirosantilli.json +1 -1
package/.eslintrc.json
CHANGED
|
@@ -1,277 +1,54 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"implicit-arrow-linebreak": "error",
|
|
55
|
-
"indent": ["error", 2, { "SwitchCase": 1 }],
|
|
56
|
-
"indent-legacy": "off",
|
|
57
|
-
"init-declarations": "error",
|
|
58
|
-
"jsx-quotes": "error",
|
|
59
|
-
"key-spacing": "error",
|
|
60
|
-
"keyword-spacing": "error",
|
|
61
|
-
"line-comment-position": "error",
|
|
62
|
-
"linebreak-style": "off",
|
|
63
|
-
"lines-around-comment": "off",
|
|
64
|
-
"lines-around-directive": "error",
|
|
65
|
-
"lines-between-class-members": "error",
|
|
66
|
-
"max-classes-per-file": "error",
|
|
67
|
-
"max-depth": "error",
|
|
68
|
-
"max-len": "error",
|
|
69
|
-
"max-lines": "off",
|
|
70
|
-
"max-lines-per-function": "off",
|
|
71
|
-
"max-nested-callbacks": "error",
|
|
72
|
-
"max-params": ["error", 9],
|
|
73
|
-
"max-statements": ["error", 33],
|
|
74
|
-
"max-statements-per-line": "error",
|
|
75
|
-
"multiline-comment-style": ["error", "separate-lines"],
|
|
76
|
-
"multiline-ternary": "off",
|
|
77
|
-
"new-cap": "error",
|
|
78
|
-
"new-parens": "error",
|
|
79
|
-
"newline-after-var": "off",
|
|
80
|
-
"newline-before-return": "off",
|
|
81
|
-
"newline-per-chained-call": "off",
|
|
82
|
-
"no-alert": "error",
|
|
83
|
-
"no-array-constructor": "error",
|
|
84
|
-
"no-async-promise-executor": "error",
|
|
85
|
-
"no-await-in-loop": "error",
|
|
86
|
-
"no-bitwise": "off",
|
|
87
|
-
"no-buffer-constructor": "error",
|
|
88
|
-
"no-caller": "error",
|
|
89
|
-
"no-case-declarations": "error",
|
|
90
|
-
"no-catch-shadow": "error",
|
|
91
|
-
"no-class-assign": "error",
|
|
92
|
-
"no-compare-neg-zero": "error",
|
|
93
|
-
"no-cond-assign": "error",
|
|
94
|
-
"no-confusing-arrow": "error",
|
|
95
|
-
"no-console": "error",
|
|
96
|
-
"no-const-assign": "error",
|
|
97
|
-
"no-constant-condition": "error",
|
|
98
|
-
"no-continue": "error",
|
|
99
|
-
"no-control-regex": "error",
|
|
100
|
-
"no-debugger": "error",
|
|
101
|
-
"no-delete-var": "error",
|
|
102
|
-
"no-div-regex": "error",
|
|
103
|
-
"no-dupe-args": "error",
|
|
104
|
-
"no-dupe-class-members": "error",
|
|
105
|
-
"no-dupe-keys": "error",
|
|
106
|
-
"no-duplicate-case": "error",
|
|
107
|
-
"no-duplicate-imports": "error",
|
|
108
|
-
"no-else-return": "error",
|
|
109
|
-
"no-empty": "error",
|
|
110
|
-
"no-empty-character-class": "error",
|
|
111
|
-
"no-empty-function": "off",
|
|
112
|
-
"no-empty-pattern": "error",
|
|
113
|
-
"no-eq-null": "error",
|
|
114
|
-
"no-eval": "error",
|
|
115
|
-
"no-ex-assign": "error",
|
|
116
|
-
"no-extend-native": "error",
|
|
117
|
-
"no-extra-bind": "error",
|
|
118
|
-
"no-extra-boolean-cast": "error",
|
|
119
|
-
"no-extra-label": "error",
|
|
120
|
-
"no-extra-parens": "off",
|
|
121
|
-
"no-extra-semi": "error",
|
|
122
|
-
"no-fallthrough": "error",
|
|
123
|
-
"no-floating-decimal": "error",
|
|
124
|
-
"no-func-assign": "error",
|
|
125
|
-
"no-global-assign": "error",
|
|
126
|
-
"no-implicit-coercion": "off",
|
|
127
|
-
"no-implicit-globals": "error",
|
|
128
|
-
"no-implied-eval": "error",
|
|
129
|
-
"no-inline-comments": "error",
|
|
130
|
-
"no-inner-declarations": "error",
|
|
131
|
-
"no-invalid-regexp": "error",
|
|
132
|
-
"no-invalid-this": "off",
|
|
133
|
-
"no-irregular-whitespace": "error",
|
|
134
|
-
"no-iterator": "error",
|
|
135
|
-
"no-label-var": "error",
|
|
136
|
-
"no-labels": "error",
|
|
137
|
-
"no-lone-blocks": "error",
|
|
138
|
-
"no-lonely-if": "error",
|
|
139
|
-
"no-loop-func": "error",
|
|
140
|
-
"no-magic-numbers": "off",
|
|
141
|
-
"no-misleading-character-class": "error",
|
|
142
|
-
"no-mixed-operators": "error",
|
|
143
|
-
"no-mixed-requires": "error",
|
|
144
|
-
"no-mixed-spaces-and-tabs": "error",
|
|
145
|
-
"no-multi-assign": "off",
|
|
146
|
-
"no-multi-spaces": "error",
|
|
147
|
-
"no-multi-str": "error",
|
|
148
|
-
"no-multiple-empty-lines": "error",
|
|
149
|
-
"no-native-reassign": "error",
|
|
150
|
-
"no-negated-condition": "error",
|
|
151
|
-
"no-negated-in-lhs": "error",
|
|
152
|
-
"no-nested-ternary": "off",
|
|
153
|
-
"no-new": "error",
|
|
154
|
-
"no-new-func": "error",
|
|
155
|
-
"no-new-object": "error",
|
|
156
|
-
"no-new-require": "error",
|
|
157
|
-
"no-new-symbol": "error",
|
|
158
|
-
"no-new-wrappers": "error",
|
|
159
|
-
"no-obj-calls": "error",
|
|
160
|
-
"no-octal": "error",
|
|
161
|
-
"no-octal-escape": "error",
|
|
162
|
-
"no-param-reassign": "off",
|
|
163
|
-
"no-path-concat": "error",
|
|
164
|
-
"no-plusplus": "off",
|
|
165
|
-
"no-process-env": "error",
|
|
166
|
-
"no-process-exit": "error",
|
|
167
|
-
"no-proto": "error",
|
|
168
|
-
"no-prototype-builtins": "error",
|
|
169
|
-
"no-redeclare": "error",
|
|
170
|
-
"no-regex-spaces": "error",
|
|
171
|
-
"no-restricted-globals": "error",
|
|
172
|
-
"no-restricted-imports": "error",
|
|
173
|
-
"no-restricted-modules": "error",
|
|
174
|
-
"no-restricted-properties": "error",
|
|
175
|
-
"no-restricted-syntax": "error",
|
|
176
|
-
"no-return-assign": "error",
|
|
177
|
-
"no-return-await": "error",
|
|
178
|
-
"no-script-url": "error",
|
|
179
|
-
"no-self-assign": "error",
|
|
180
|
-
"no-self-compare": "error",
|
|
181
|
-
"no-sequences": "error",
|
|
182
|
-
"no-shadow": "error",
|
|
183
|
-
"no-shadow-restricted-names": "error",
|
|
184
|
-
"no-spaced-func": "error",
|
|
185
|
-
"no-sparse-arrays": "error",
|
|
186
|
-
"no-sync": "off",
|
|
187
|
-
"no-tabs": "error",
|
|
188
|
-
"no-template-curly-in-string": "error",
|
|
189
|
-
"no-ternary": "off",
|
|
190
|
-
"no-this-before-super": "error",
|
|
191
|
-
"no-throw-literal": "error",
|
|
192
|
-
"no-trailing-spaces": "error",
|
|
193
|
-
"no-undef": "error",
|
|
194
|
-
"no-undef-init": "error",
|
|
195
|
-
"no-undefined": "off",
|
|
196
|
-
"no-underscore-dangle": "error",
|
|
197
|
-
"no-unexpected-multiline": "error",
|
|
198
|
-
"no-unmodified-loop-condition": "error",
|
|
199
|
-
"no-unneeded-ternary": "error",
|
|
200
|
-
"no-unreachable": "error",
|
|
201
|
-
"no-unsafe-finally": "error",
|
|
202
|
-
"no-unsafe-negation": "error",
|
|
203
|
-
"no-unused-expressions": "error",
|
|
204
|
-
"no-unused-labels": "error",
|
|
205
|
-
"no-unused-vars": "error",
|
|
206
|
-
"no-use-before-define": "error",
|
|
207
|
-
"no-useless-call": "error",
|
|
208
|
-
"no-useless-catch": "error",
|
|
209
|
-
"no-useless-computed-key": "error",
|
|
210
|
-
"no-useless-concat": "error",
|
|
211
|
-
"no-useless-constructor": "error",
|
|
212
|
-
"no-useless-escape": "error",
|
|
213
|
-
"no-useless-rename": "error",
|
|
214
|
-
"no-useless-return": "error",
|
|
215
|
-
"no-var": "error",
|
|
216
|
-
"no-void": "error",
|
|
217
|
-
"no-warning-comments": "error",
|
|
218
|
-
"no-whitespace-before-property": "error",
|
|
219
|
-
"no-with": "error",
|
|
220
|
-
"nonblock-statement-body-position": "error",
|
|
221
|
-
"object-curly-newline": "off",
|
|
222
|
-
"object-curly-spacing": ["error", "always"],
|
|
223
|
-
"object-property-newline": "error",
|
|
224
|
-
"object-shorthand": "off",
|
|
225
|
-
"one-var": "off",
|
|
226
|
-
"one-var-declaration-per-line": "error",
|
|
227
|
-
"operator-assignment": "error",
|
|
228
|
-
"operator-linebreak": ["error", "after"],
|
|
229
|
-
"padded-blocks": "off",
|
|
230
|
-
"padding-line-between-statements": "off",
|
|
231
|
-
"prefer-arrow-callback": "off",
|
|
232
|
-
"prefer-const": "error",
|
|
233
|
-
"prefer-destructuring": "off",
|
|
234
|
-
"prefer-numeric-literals": "error",
|
|
235
|
-
"prefer-object-spread": "error",
|
|
236
|
-
"prefer-promise-reject-errors": "error",
|
|
237
|
-
"prefer-reflect": "off",
|
|
238
|
-
"prefer-rest-params": "error",
|
|
239
|
-
"prefer-spread": "error",
|
|
240
|
-
"prefer-template": "off",
|
|
241
|
-
"quote-props": "error",
|
|
242
|
-
"quotes": "error",
|
|
243
|
-
"radix": "error",
|
|
244
|
-
"require-atomic-updates": "error",
|
|
245
|
-
"require-await": "error",
|
|
246
|
-
"require-jsdoc": "off",
|
|
247
|
-
"require-unicode-regexp": "off",
|
|
248
|
-
"require-yield": "error",
|
|
249
|
-
"rest-spread-spacing": "error",
|
|
250
|
-
"semi": "error",
|
|
251
|
-
"semi-spacing": "error",
|
|
252
|
-
"semi-style": "error",
|
|
253
|
-
"sort-imports": "error",
|
|
254
|
-
"sort-keys": "off",
|
|
255
|
-
"sort-vars": "error",
|
|
256
|
-
"space-before-blocks": "error",
|
|
257
|
-
"space-before-function-paren": ["error", "never"],
|
|
258
|
-
"space-in-parens": "error",
|
|
259
|
-
"space-infix-ops": "error",
|
|
260
|
-
"space-unary-ops": "error",
|
|
261
|
-
"spaced-comment": "error",
|
|
262
|
-
"strict": "error",
|
|
263
|
-
"switch-colon-spacing": "error",
|
|
264
|
-
"symbol-description": "error",
|
|
265
|
-
"template-curly-spacing": "error",
|
|
266
|
-
"template-tag-spacing": "error",
|
|
267
|
-
"unicode-bom": "error",
|
|
268
|
-
"use-isnan": "error",
|
|
269
|
-
"valid-jsdoc": "error",
|
|
270
|
-
"valid-typeof": "error",
|
|
271
|
-
"vars-on-top": "off",
|
|
272
|
-
"wrap-iife": "error",
|
|
273
|
-
"wrap-regex": "off",
|
|
274
|
-
"yield-star-spacing": "error",
|
|
275
|
-
"yoda": "error"
|
|
276
|
-
}
|
|
2
|
+
"parser": "espree",
|
|
3
|
+
"parserOptions": {
|
|
4
|
+
"ecmaVersion": 2018
|
|
5
|
+
},
|
|
6
|
+
"env": {
|
|
7
|
+
"node": true,
|
|
8
|
+
"es6": true
|
|
9
|
+
},
|
|
10
|
+
"extends": "eslint:all",
|
|
11
|
+
"rules": {
|
|
12
|
+
"array-bracket-spacing": ["error", "always"],
|
|
13
|
+
"array-element-newline": "off",
|
|
14
|
+
"capitalized-comments": "off",
|
|
15
|
+
"dot-location": ["error", "property"],
|
|
16
|
+
"func-style": ["error", "declaration"],
|
|
17
|
+
"function-paren-newline": "off",
|
|
18
|
+
"global-require": "off",
|
|
19
|
+
"id-length": "off",
|
|
20
|
+
"indent": ["error", 2, { "SwitchCase": 1 }],
|
|
21
|
+
"linebreak-style": "off",
|
|
22
|
+
"max-lines": "off",
|
|
23
|
+
"max-lines-per-function": "off",
|
|
24
|
+
"max-params": ["error", 10],
|
|
25
|
+
"max-statements": ["error", 33],
|
|
26
|
+
"multiline-comment-style": ["error", "separate-lines"],
|
|
27
|
+
"multiline-ternary": "off",
|
|
28
|
+
"newline-per-chained-call": "off",
|
|
29
|
+
"no-empty-function": "off",
|
|
30
|
+
"no-extra-parens": "off",
|
|
31
|
+
"no-implicit-coercion": "off",
|
|
32
|
+
"no-magic-numbers": "off",
|
|
33
|
+
"no-nested-ternary": "off",
|
|
34
|
+
"no-param-reassign": "off",
|
|
35
|
+
"no-plusplus": "off",
|
|
36
|
+
"no-sync": "off",
|
|
37
|
+
"no-ternary": "off",
|
|
38
|
+
"no-undefined": "off",
|
|
39
|
+
"object-curly-spacing": ["error", "always"],
|
|
40
|
+
"object-shorthand": "off",
|
|
41
|
+
"one-var": "off",
|
|
42
|
+
"operator-linebreak": ["error", "after"],
|
|
43
|
+
"padded-blocks": "off",
|
|
44
|
+
"prefer-arrow-callback": "off",
|
|
45
|
+
"prefer-destructuring": "off",
|
|
46
|
+
"prefer-named-capture-group": "off",
|
|
47
|
+
"prefer-template": "off",
|
|
48
|
+
"require-unicode-regexp": "off",
|
|
49
|
+
"sort-keys": "off",
|
|
50
|
+
"space-before-function-paren": ["error", "never"],
|
|
51
|
+
"vars-on-top": "off",
|
|
52
|
+
"wrap-regex": "off"
|
|
53
|
+
}
|
|
277
54
|
}
|
package/.travis.yml
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
language: node_js
|
|
2
2
|
node_js:
|
|
3
|
-
- "6"
|
|
4
3
|
- "8"
|
|
5
4
|
- "10"
|
|
5
|
+
- "12"
|
|
6
6
|
os:
|
|
7
7
|
- windows
|
|
8
8
|
- linux
|
|
9
9
|
- osx
|
|
10
10
|
cache: npm
|
|
11
11
|
script: "npm run-script test-cover"
|
|
12
|
-
after_script: "npm install coveralls &&
|
|
12
|
+
after_script: "npm install coveralls && nyc report --reporter=text-lcov | coveralls"
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -19,16 +19,17 @@ The [Markdown](https://en.wikipedia.org/wiki/Markdown) markup language is
|
|
|
19
19
|
designed to be easy to read, write, and understand. It succeeds - and its
|
|
20
20
|
flexibility is both a benefit and a drawback. Many styles are possible, so
|
|
21
21
|
formatting can be inconsistent. Some constructs don't work well in all
|
|
22
|
-
parsers and should be avoided. The [CommonMark](
|
|
22
|
+
parsers and should be avoided. The [CommonMark](https://commonmark.org/)
|
|
23
23
|
specification standardizes parsers - but not authors.
|
|
24
24
|
|
|
25
|
-
`markdownlint` is a
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
`markdownlint` is a
|
|
26
|
+
[static analysis](https://en.wikipedia.org/wiki/Static_program_analysis)
|
|
27
|
+
tool for [Node.js](https://nodejs.org/) with a library of rules
|
|
28
|
+
to enforce standards and consistency for Markdown files. It was
|
|
29
|
+
inspired by - and heavily influenced by - Mark Harrison's
|
|
29
30
|
[markdownlint](https://github.com/markdownlint/markdownlint) for
|
|
30
|
-
[Ruby](https://www.ruby-lang.org/). The initial rules, rule documentation,
|
|
31
|
-
test cases came directly from that project.
|
|
31
|
+
[Ruby](https://www.ruby-lang.org/). The initial rules, rule documentation,
|
|
32
|
+
and test cases came directly from that project.
|
|
32
33
|
|
|
33
34
|
### Related
|
|
34
35
|
|
|
@@ -66,7 +67,7 @@ playground for learning and exploring.
|
|
|
66
67
|
* **[MD022](doc/Rules.md#md022)** *blanks-around-headings/blanks-around-headers* - Headings should be surrounded by blank lines
|
|
67
68
|
* **[MD023](doc/Rules.md#md023)** *heading-start-left/header-start-left* - Headings must start at the beginning of the line
|
|
68
69
|
* **[MD024](doc/Rules.md#md024)** *no-duplicate-heading/no-duplicate-header* - Multiple headings with the same content
|
|
69
|
-
* **[MD025](doc/Rules.md#md025)** *single-h1* - Multiple top level headings in the same document
|
|
70
|
+
* **[MD025](doc/Rules.md#md025)** *single-title/single-h1* - Multiple top level headings in the same document
|
|
70
71
|
* **[MD026](doc/Rules.md#md026)** *no-trailing-punctuation* - Trailing punctuation in heading
|
|
71
72
|
* **[MD027](doc/Rules.md#md027)** *no-multiple-space-blockquote* - Multiple spaces after blockquote symbol
|
|
72
73
|
* **[MD028](doc/Rules.md#md028)** *no-blanks-blockquote* - Blank line inside blockquote
|
|
@@ -82,11 +83,13 @@ playground for learning and exploring.
|
|
|
82
83
|
* **[MD038](doc/Rules.md#md038)** *no-space-in-code* - Spaces inside code span elements
|
|
83
84
|
* **[MD039](doc/Rules.md#md039)** *no-space-in-links* - Spaces inside link text
|
|
84
85
|
* **[MD040](doc/Rules.md#md040)** *fenced-code-language* - Fenced code blocks should have a language specified
|
|
85
|
-
* **[MD041](doc/Rules.md#md041)** *first-line-h1* - First line in file should be a top level heading
|
|
86
|
+
* **[MD041](doc/Rules.md#md041)** *first-line-heading/first-line-h1* - First line in file should be a top level heading
|
|
86
87
|
* **[MD042](doc/Rules.md#md042)** *no-empty-links* - No empty links
|
|
87
88
|
* **[MD043](doc/Rules.md#md043)** *required-headings/required-headers* - Required heading structure
|
|
88
89
|
* **[MD044](doc/Rules.md#md044)** *proper-names* - Proper names should have the correct capitalization
|
|
89
90
|
* **[MD045](doc/Rules.md#md045)** *no-alt-text* - Images should have alternate text (alt text)
|
|
91
|
+
* **[MD046](doc/Rules.md#md046)** *code-block-style* - Code block style
|
|
92
|
+
* **[MD047](doc/Rules.md#md047)** *single-trailing-newline* - Files should end with a single newline character
|
|
90
93
|
|
|
91
94
|
See [Rules.md](doc/Rules.md) for more details.
|
|
92
95
|
|
|
@@ -101,10 +104,10 @@ Tags group related rules and can be used to enable/disable multiple rules at onc
|
|
|
101
104
|
* **accessibility** - MD045
|
|
102
105
|
* **atx** - MD018, MD019
|
|
103
106
|
* **atx_closed** - MD020, MD021
|
|
104
|
-
* **blank_lines** - MD012, MD022, MD031, MD032
|
|
107
|
+
* **blank_lines** - MD012, MD022, MD031, MD032, MD047
|
|
105
108
|
* **blockquote** - MD027, MD028
|
|
106
109
|
* **bullet** - MD004, MD005, MD006, MD007, MD032
|
|
107
|
-
* **code** - MD014, MD031, MD038, MD040
|
|
110
|
+
* **code** - MD014, MD031, MD038, MD040, MD046
|
|
108
111
|
* **emphasis** - MD036, MD037
|
|
109
112
|
* **hard_tab** - MD010
|
|
110
113
|
* **headers** - MD001, MD002, MD003, MD018, MD019, MD020, MD021, MD022, MD023,
|
|
@@ -287,7 +290,7 @@ const options = {
|
|
|
287
290
|
See the [style](style) directory for more samples.
|
|
288
291
|
|
|
289
292
|
See [markdownlint-config-schema.json](schema/markdownlint-config-schema.json)
|
|
290
|
-
for the [JSON Schema](
|
|
293
|
+
for the [JSON Schema](https://json-schema.org/) of the `options.config` object.
|
|
291
294
|
|
|
292
295
|
For more advanced scenarios, styles can reference and extend other styles. The
|
|
293
296
|
`readConfig` and `readConfigSync` functions can be used to read such styles.
|
|
@@ -342,7 +345,7 @@ ignores common forms of "front matter". To match differently, specify a custom
|
|
|
342
345
|
The default value:
|
|
343
346
|
|
|
344
347
|
```js
|
|
345
|
-
|
|
348
|
+
/((^---$[^]*?^---$)|(^\+\+\+$[^]*?^(\+\+\+|\.\.\.)$))(\r\n|\r|\n|$)/m
|
|
346
349
|
```
|
|
347
350
|
|
|
348
351
|
Ignores [YAML](https://en.wikipedia.org/wiki/YAML) and
|
|
@@ -357,6 +360,21 @@ title: Title
|
|
|
357
360
|
|
|
358
361
|
Note: Matches must occur at the start of the file.
|
|
359
362
|
|
|
363
|
+
##### options.handleRuleFailures
|
|
364
|
+
|
|
365
|
+
Type: `Boolean`
|
|
366
|
+
|
|
367
|
+
Catches exceptions thrown during rule processing and reports the problem as a
|
|
368
|
+
rule violation.
|
|
369
|
+
|
|
370
|
+
By default, exceptions thrown by rules (or the library itself) are unhandled
|
|
371
|
+
and bubble up the stack to the caller in the conventional manner. By setting
|
|
372
|
+
`handleRuleFailures` to `true`, exceptions thrown by failing rules will be
|
|
373
|
+
handled by the library and the exception message logged as a rule violation.
|
|
374
|
+
This setting can be useful in the presence of (custom) rules that encounter
|
|
375
|
+
unexpected syntax and fail. By enabling this option, the linting process is
|
|
376
|
+
allowed to continue and report any violations that were found.
|
|
377
|
+
|
|
360
378
|
##### options.noInlineConfig
|
|
361
379
|
|
|
362
380
|
Type: `Boolean`
|
|
@@ -518,12 +536,12 @@ Output:
|
|
|
518
536
|
```text
|
|
519
537
|
bad.string: 3: MD010/no-hard-tabs Hard tabs [Column: 19]
|
|
520
538
|
bad.string: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.string"]
|
|
521
|
-
bad.string: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This string fails
|
|
522
|
-
bad.string: 1: MD041/first-line-h1 First line in file should be a top level heading [Context: "#bad.string"]
|
|
539
|
+
bad.string: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This string fails some rules."]
|
|
540
|
+
bad.string: 1: MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "#bad.string"]
|
|
523
541
|
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
|
|
524
542
|
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
|
|
525
|
-
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails
|
|
526
|
-
bad.md: 1: MD041/first-line-h1 First line in file should be a top level heading [Context: "#bad.md"]
|
|
543
|
+
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
|
|
544
|
+
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "#bad.md"]
|
|
527
545
|
```
|
|
528
546
|
|
|
529
547
|
Or invoke `markdownlint.sync` for a synchronous call:
|
|
@@ -553,9 +571,9 @@ Output:
|
|
|
553
571
|
"ruleNames": [ "MD010", "no-hard-tabs" ],
|
|
554
572
|
"ruleDescription": "Hard tabs",
|
|
555
573
|
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010",
|
|
556
|
-
"errorDetail": "Column:
|
|
574
|
+
"errorDetail": "Column: 17",
|
|
557
575
|
"errorContext": null,
|
|
558
|
-
"errorRange": [
|
|
576
|
+
"errorRange": [ 17, 1 ] },
|
|
559
577
|
{ "lineNumber": 1,
|
|
560
578
|
"ruleNames": [ "MD018", "no-missing-space-atx" ],
|
|
561
579
|
"ruleDescription": "No space after hash on atx style heading",
|
|
@@ -571,7 +589,7 @@ Output:
|
|
|
571
589
|
"errorContext": "#This file fails\tsome rules.",
|
|
572
590
|
"errorRange": [ 1, 2 ] },
|
|
573
591
|
{ "lineNumber": 1,
|
|
574
|
-
"ruleNames": [ "MD041", "first-line-h1" ],
|
|
592
|
+
"ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
|
|
575
593
|
"ruleDescription": "First line in file should be a top level heading",
|
|
576
594
|
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041",
|
|
577
595
|
"errorDetail": null,
|
|
@@ -581,7 +599,7 @@ Output:
|
|
|
581
599
|
}
|
|
582
600
|
```
|
|
583
601
|
|
|
584
|
-
Integration with the [gulp](
|
|
602
|
+
Integration with the [gulp](https://gulpjs.com/) build system is straightforward:
|
|
585
603
|
|
|
586
604
|
```js
|
|
587
605
|
const gulp = require("gulp");
|
|
@@ -610,12 +628,12 @@ Output:
|
|
|
610
628
|
[00:00:00] Starting 'markdownlint'...
|
|
611
629
|
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
|
|
612
630
|
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
|
|
613
|
-
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails
|
|
614
|
-
bad.md: 1: MD041/first-line-h1 First line in file should be a top level heading [Context: "#bad.md"]
|
|
631
|
+
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
|
|
632
|
+
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "#bad.md"]
|
|
615
633
|
[00:00:00] Finished 'markdownlint' after 10 ms
|
|
616
634
|
```
|
|
617
635
|
|
|
618
|
-
Integration with the [Grunt](
|
|
636
|
+
Integration with the [Grunt](https://gruntjs.com/) build system is similar:
|
|
619
637
|
|
|
620
638
|
```js
|
|
621
639
|
const markdownlint = require("markdownlint");
|
|
@@ -651,8 +669,8 @@ Running "markdownlint:example" (markdownlint) task
|
|
|
651
669
|
Warning:
|
|
652
670
|
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
|
|
653
671
|
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
|
|
654
|
-
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails
|
|
655
|
-
bad.md: 1: MD041/first-line-h1 First line in file should be a top level heading [Context: "#bad.md"]
|
|
672
|
+
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
|
|
673
|
+
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "#bad.md"]
|
|
656
674
|
Use --force to continue.
|
|
657
675
|
```
|
|
658
676
|
|
|
@@ -690,11 +708,13 @@ For ideas how to integrate `markdownlint` into your workflow, refer to the follo
|
|
|
690
708
|
|
|
691
709
|
* [ally.js](https://allyjs.io/) ([Search repository](https://github.com/medialize/ally.js/search?q=markdownlint))
|
|
692
710
|
* [ESLint](https://eslint.org/) ([Search repository](https://github.com/eslint/eslint/search?q=markdownlint))
|
|
711
|
+
* [Garden React Components](https://garden.zendesk.com/react-components/) ([Search repository](https://github.com/zendeskgarden/react-components/search?q=markdownlint))
|
|
693
712
|
* [Mocha](https://mochajs.org/) ([Search repository](https://github.com/mochajs/mocha/search?q=markdownlint))
|
|
694
713
|
* [Reactable](https://glittershark.github.io/reactable/) ([Search repository](https://github.com/glittershark/reactable/search?q=markdownlint))
|
|
695
714
|
* [Sinon.JS](https://sinonjs.org/) ([Search repository](https://github.com/sinonjs/sinon/search?q=markdownlint))
|
|
696
715
|
* [TestCafe](https://devexpress.github.io/testcafe/) ([Search repository](https://github.com/DevExpress/testcafe/search?q=markdownlint))
|
|
697
716
|
* [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/basic-types.html) ([Search repository](https://github.com/Microsoft/TypeScript-Handbook/search?q=markdownlint))
|
|
717
|
+
* [V8](https://v8.dev/) ([Search repository](https://github.com/v8/v8.dev/search?q=markdownlint))
|
|
698
718
|
* [webhint](https://webhint.io/) ([Search repository](https://github.com/webhintio/hint/search?q=markdownlint))
|
|
699
719
|
* [webpack](https://webpack.js.org/) ([Search repository](https://github.com/webpack/webpack.js.org/search?q=markdownlint))
|
|
700
720
|
|
|
@@ -720,7 +740,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
|
|
|
720
740
|
* 0.3.1 - Fix regressions in MD032/MD038, update dependencies.
|
|
721
741
|
* 0.4.0 - Add MD044, enhance MD013/MD032/MD041/MD042/MD043, fix for MD038, dependencies.
|
|
722
742
|
* 0.4.1 - Fixes for MD038/front matter, improvements to MD044, update dependencies.
|
|
723
|
-
* 0.5.0 - Add shareable configuration, noInlineConfig option, README links, fix MD030,
|
|
743
|
+
* 0.5.0 - Add shareable configuration, `noInlineConfig` option, README links, fix MD030,
|
|
724
744
|
improve MD009/MD041, update dependencies.
|
|
725
745
|
* 0.6.0 - `resultVersion` defaults to 1 (breaking change), ignore HTML comments, TOML
|
|
726
746
|
front matter, fixes for MD044, update dependencies.
|
|
@@ -742,6 +762,13 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
|
|
|
742
762
|
update dependencies.
|
|
743
763
|
* 0.12.0 - Add `information` link for custom rules, `markdownItPlugins` for extensibility,
|
|
744
764
|
improve MD023/MD032/MD038, update dependencies.
|
|
765
|
+
* 0.13.0 - Improve MD013/MD022/MD025/MD029/MD031/MD032/MD037/MD041/, deprecate MD002,
|
|
766
|
+
improve pandoc YAML support, update dependencies.
|
|
767
|
+
* 0.14.0 - Remove support for end-of-life Node version 6, introduce `markdownlint-rule-helpers`,
|
|
768
|
+
add MD046/MD047, improve MD033/MD034/MD039, improve custom rule validation and
|
|
769
|
+
in-browser demo, update dependencies.
|
|
770
|
+
* 0.14.1 - Improve MD033.
|
|
771
|
+
* 0.14.2 - Improve MD047, add `handleRuleFailures` option.
|
|
745
772
|
|
|
746
773
|
[npm-image]: https://img.shields.io/npm/v/markdownlint.svg
|
|
747
774
|
[npm-url]: https://www.npmjs.com/package/markdownlint
|
package/doc/CustomRules.md
CHANGED
|
@@ -53,16 +53,21 @@ A rule is implemented as an `Object` with four required properties:
|
|
|
53
53
|
- `context` is an optional `String` with relevant text surrounding the error location.
|
|
54
54
|
- `range` is an optional `Array` with two `Number` values identifying the 1-based column and length of the error.
|
|
55
55
|
|
|
56
|
+
The collection of helper functions shared by the built-in rules is available for use by custom rules in the [markdownlint-rule-helpers package](https://www.npmjs.com/package/markdownlint-rule-helpers).
|
|
57
|
+
|
|
56
58
|
## Examples
|
|
57
59
|
|
|
58
60
|
- [Simple rules used by the project's test cases](../test/rules)
|
|
59
61
|
- [Code for all `markdownlint` built-in rules](../lib)
|
|
60
62
|
- [Package configuration for publishing to npm](../test/rules/npm)
|
|
61
|
-
-
|
|
63
|
+
- Packages should export a single rule object or an `Array` of rule objects
|
|
64
|
+
- [Custom rules from the Microsoft/vscode-docs-authoring repository](https://github.com/Microsoft/vscode-docs-authoring/tree/master/docs-markdown/markdownlint-custom-rules)
|
|
65
|
+
- [Custom rules from the axibase/docs-util repository](https://github.com/axibase/docs-util/tree/master/linting-rules)
|
|
66
|
+
- [Custom rules from the webhintio/hint repository](https://github.com/webhintio/hint/blob/master/scripts/lint-markdown.js)
|
|
62
67
|
|
|
63
68
|
## References
|
|
64
69
|
|
|
65
|
-
- [CommonMark documentation and specification](
|
|
70
|
+
- [CommonMark documentation and specification](https://commonmark.org/)
|
|
66
71
|
- [`markdown-it` Markdown parser project page](https://github.com/markdown-it/markdown-it)
|
|
67
72
|
|
|
68
73
|
## Params
|