markdownlint 0.35.0 → 0.36.1
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/CHANGELOG.md +14 -0
- package/README.md +72 -35
- package/demo/markdownlint-browser.js +1259 -1215
- package/doc/CustomRules.md +55 -249
- package/doc/Rules.md +36 -29
- package/doc/md003.md +2 -2
- package/doc/md004.md +4 -3
- package/doc/md035.md +3 -8
- package/doc/md046.md +2 -2
- package/doc/md048.md +3 -2
- package/doc/md049.md +4 -3
- package/doc/md050.md +4 -4
- package/doc/md051.md +11 -3
- package/doc/md055.md +3 -2
- package/helpers/README.md +2 -19
- package/helpers/helpers.js +87 -347
- package/helpers/micromark-helpers.cjs +296 -0
- package/helpers/micromark-parse.cjs +313 -0
- package/helpers/package.json +5 -2
- package/helpers/shared.js +6 -0
- package/helpers/test.cjs +28 -0
- package/lib/cache.js +3 -3
- package/lib/configuration-strict.d.ts +120 -106
- package/lib/constants.js +1 -1
- package/lib/markdownit.cjs +172 -0
- package/lib/markdownlint.d.ts +41 -3
- package/lib/markdownlint.js +153 -115
- package/lib/md001.js +1 -1
- package/lib/md003.js +1 -1
- package/lib/md004.js +3 -3
- package/lib/md007.js +3 -3
- package/lib/md009.js +1 -1
- package/lib/md010.js +18 -14
- package/lib/md011.js +24 -23
- package/lib/md012.js +1 -1
- package/lib/md013.js +1 -1
- package/lib/md014.js +5 -9
- package/lib/md018.js +1 -1
- package/lib/md019-md021.js +1 -1
- package/lib/md020.js +2 -2
- package/lib/md022.js +9 -15
- package/lib/md024.js +1 -1
- package/lib/md025.js +1 -1
- package/lib/md027.js +2 -2
- package/lib/md029.js +3 -3
- package/lib/md031.js +8 -6
- package/lib/md032.js +27 -15
- package/lib/md033.js +1 -1
- package/lib/md034.js +21 -29
- package/lib/md036.js +18 -24
- package/lib/md037.js +1 -1
- package/lib/md038.js +9 -14
- package/lib/md039.js +13 -15
- package/lib/md040.js +11 -13
- package/lib/md041.js +4 -4
- package/lib/md042.js +2 -6
- package/lib/md043.js +1 -1
- package/lib/md044.js +31 -28
- package/lib/md045.js +2 -2
- package/lib/md048.js +28 -17
- package/lib/md049-md050.js +20 -5
- package/lib/md051.js +16 -18
- package/lib/md053.js +5 -4
- package/lib/md054.js +11 -13
- package/lib/md055.js +39 -46
- package/lib/md056.js +31 -36
- package/lib/md058.js +29 -14
- package/package.json +14 -13
- package/schema/.markdownlint.jsonc +55 -52
- package/schema/.markdownlint.yaml +54 -52
- package/schema/markdownlint-config-schema-strict.json +132 -110
- package/schema/markdownlint-config-schema.json +132 -110
- package/helpers/micromark.cjs +0 -544
package/doc/CustomRules.md
CHANGED
|
@@ -14,9 +14,8 @@ built-in rules.
|
|
|
14
14
|
For simple requirements like disallowing certain characters or patterns,
|
|
15
15
|
the community-developed
|
|
16
16
|
[markdownlint-rule-search-replace][markdownlint-rule-search-replace]
|
|
17
|
-
plug-in can be used.
|
|
18
|
-
|
|
19
|
-
JSON without needing to write any code.
|
|
17
|
+
plug-in can be used. This plug-in allows anyone to create a set of simple
|
|
18
|
+
text-replacement rules without needing to write code.
|
|
20
19
|
|
|
21
20
|
[markdownlint-rule-search-replace]: https://www.npmjs.com/package/markdownlint-rule-search-replace
|
|
22
21
|
|
|
@@ -27,29 +26,62 @@ to more information, one or more tags, and a function that implements the rule's
|
|
|
27
26
|
behavior. That function is called once for each file/string input and is passed
|
|
28
27
|
the parsed input and a function to log any violations.
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
Custom rules can (should) operate on a structured set of tokens based on the
|
|
30
|
+
[`micromark`][micromark] `parser` (this is preferred). Alternatively, custom
|
|
31
|
+
rules can operate on a structured set of tokens based on the
|
|
32
|
+
[`markdown-it`][markdown-it] `parser` (legacy support). Finally, custom rules
|
|
33
|
+
can operate directly on text with the `none` `parser`.
|
|
34
|
+
|
|
35
|
+
A simple rule implementation using the `micromark` parser to report a violation
|
|
36
|
+
for any use of blockquotes might look like:
|
|
31
37
|
|
|
32
38
|
```javascript
|
|
33
39
|
/** @type import("markdownlint").Rule */
|
|
34
40
|
module.exports = {
|
|
35
|
-
"names": [ "any-blockquote" ],
|
|
41
|
+
"names": [ "any-blockquote-micromark" ],
|
|
42
|
+
"description": "Rule that reports an error for any blockquote",
|
|
43
|
+
"information": new URL("https://example.com/rules/any-blockquote"),
|
|
44
|
+
"tags": [ "test" ],
|
|
45
|
+
"parser": "micromark",
|
|
46
|
+
"function": (params, onError) => {
|
|
47
|
+
const blockquotes = params.parsers.micromark.tokens
|
|
48
|
+
.filter((token) => token.type === "blockQuote");
|
|
49
|
+
for (const blockquote of blockquotes) {
|
|
50
|
+
const lines = blockquote.endLine - blockquote.startLine + 1;
|
|
51
|
+
onError({
|
|
52
|
+
"lineNumber": blockquote.startLine,
|
|
53
|
+
"detail": "Blockquote spans " + lines + " line(s).",
|
|
54
|
+
"context": params.lines[blockquote.startLine - 1]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
That same rule implemented using the `markdown-it` parser might look like:
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
/** @type import("markdownlint").Rule */
|
|
65
|
+
module.exports = {
|
|
66
|
+
"names": [ "any-blockquote-markdown-it" ],
|
|
36
67
|
"description": "Rule that reports an error for any blockquote",
|
|
37
68
|
"information": new URL("https://example.com/rules/any-blockquote"),
|
|
38
69
|
"tags": [ "test" ],
|
|
39
70
|
"parser": "markdownit",
|
|
40
|
-
"function":
|
|
41
|
-
params.parsers.markdownit.tokens
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
71
|
+
"function": (params, onError) => {
|
|
72
|
+
const blockquotes = params.parsers.markdownit.tokens
|
|
73
|
+
.filter((token) => token.type === "blockquote_open");
|
|
74
|
+
for (const blockquote of blockquotes) {
|
|
75
|
+
const [ startIndex, endIndex ] = blockquote.map;
|
|
76
|
+
const lines = endIndex - startIndex;
|
|
45
77
|
onError({
|
|
46
78
|
"lineNumber": blockquote.lineNumber,
|
|
47
79
|
"detail": "Blockquote spans " + lines + " line(s).",
|
|
48
|
-
"context": blockquote.line
|
|
80
|
+
"context": blockquote.line
|
|
49
81
|
});
|
|
50
|
-
}
|
|
82
|
+
}
|
|
51
83
|
}
|
|
52
|
-
}
|
|
84
|
+
}
|
|
53
85
|
```
|
|
54
86
|
|
|
55
87
|
A rule is implemented as an `Object`:
|
|
@@ -62,9 +94,8 @@ A rule is implemented as an `Object`:
|
|
|
62
94
|
about the rule.
|
|
63
95
|
- `tags` is a required `Array` of `String` values that groups related rules for
|
|
64
96
|
easier customization.
|
|
65
|
-
- `parser` is a required `String` value `"markdownit" | "none"`
|
|
66
|
-
the parser data used via `params.parsers` (see below).
|
|
67
|
-
- Note: The value `"micromark"` is valid but is NOT currently supported.
|
|
97
|
+
- `parser` is a required `String` value `"markdownit" | "micromark" | "none"`
|
|
98
|
+
that specifies the parser data used via `params.parsers` (see below).
|
|
68
99
|
- `asynchronous` is an optional `Boolean` value that indicates whether the rule
|
|
69
100
|
returns a `Promise` and runs asynchronously.
|
|
70
101
|
- `function` is a required `Function` that implements the rule and is passed two
|
|
@@ -79,12 +110,17 @@ A rule is implemented as an `Object`:
|
|
|
79
110
|
- `tokens` is an `Array` of [`markdown-it` `Token`s][markdown-it-token]
|
|
80
111
|
with added `line` and `lineNumber` properties. (This property was
|
|
81
112
|
previously on the `params` object.)
|
|
113
|
+
- `micromark` is an `Object` that provides access to output from the
|
|
114
|
+
[`micromark`][micromark] parser.
|
|
115
|
+
- `tokens` is an `Array` of [`MicromarkToken`][micromark-token] objects.
|
|
116
|
+
- Samples for both `tokens` are available via [test snapshots][tokens].
|
|
82
117
|
- `lines` is an `Array` of `String` values corresponding to the lines of the
|
|
83
118
|
input file/string.
|
|
84
119
|
- `frontMatterLines` is an `Array` of `String` values corresponding to any
|
|
85
120
|
front matter (not present in `lines`).
|
|
86
121
|
- `config` is an `Object` corresponding to the rule's entry in
|
|
87
122
|
`options.config` (if present).
|
|
123
|
+
- `version` is a `String` that corresponds to the version of `markdownlint`
|
|
88
124
|
- `onError` is a function that takes a single `Object` parameter with one
|
|
89
125
|
required and four optional properties:
|
|
90
126
|
- `lineNumber` is a required `Number` specifying the 1-based line number of
|
|
@@ -141,239 +177,6 @@ exception.
|
|
|
141
177
|
- [CommonMark documentation and specification][commonmark]
|
|
142
178
|
- [`markdown-it` Markdown parser project page][markdown-it]
|
|
143
179
|
|
|
144
|
-
## Params
|
|
145
|
-
|
|
146
|
-
The Markdown document:
|
|
147
|
-
|
|
148
|
-
```markdown
|
|
149
|
-
# Title
|
|
150
|
-
|
|
151
|
-
Text *text* text.
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
Yields the `params` object:
|
|
155
|
-
|
|
156
|
-
```json
|
|
157
|
-
{
|
|
158
|
-
"name": "doc/example.md",
|
|
159
|
-
"parsers.markdownit.tokens": [
|
|
160
|
-
{
|
|
161
|
-
"type": "heading_open",
|
|
162
|
-
"tag": "h1",
|
|
163
|
-
"attrs": null,
|
|
164
|
-
"map": [ 0, 1 ],
|
|
165
|
-
"nesting": 1,
|
|
166
|
-
"level": 0,
|
|
167
|
-
"children": null,
|
|
168
|
-
"content": "",
|
|
169
|
-
"markup": "#",
|
|
170
|
-
"info": "",
|
|
171
|
-
"meta": null,
|
|
172
|
-
"block": true,
|
|
173
|
-
"hidden": false,
|
|
174
|
-
"line": "# Title",
|
|
175
|
-
"lineNumber": 1
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
"type": "inline",
|
|
179
|
-
"tag": "",
|
|
180
|
-
"attrs": null,
|
|
181
|
-
"map": [ 0, 1 ],
|
|
182
|
-
"nesting": 0,
|
|
183
|
-
"level": 1,
|
|
184
|
-
"children": [
|
|
185
|
-
{
|
|
186
|
-
"type": "text",
|
|
187
|
-
"tag": "",
|
|
188
|
-
"attrs": null,
|
|
189
|
-
"map": null,
|
|
190
|
-
"nesting": 0,
|
|
191
|
-
"level": 0,
|
|
192
|
-
"children": null,
|
|
193
|
-
"content": "Title",
|
|
194
|
-
"markup": "",
|
|
195
|
-
"info": "",
|
|
196
|
-
"meta": null,
|
|
197
|
-
"block": false,
|
|
198
|
-
"hidden": false,
|
|
199
|
-
"lineNumber": 1,
|
|
200
|
-
"line": "# Title"
|
|
201
|
-
}
|
|
202
|
-
],
|
|
203
|
-
"content": "Title",
|
|
204
|
-
"markup": "",
|
|
205
|
-
"info": "",
|
|
206
|
-
"meta": null,
|
|
207
|
-
"block": true,
|
|
208
|
-
"hidden": false,
|
|
209
|
-
"line": "# Title",
|
|
210
|
-
"lineNumber": 1
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
"type": "heading_close",
|
|
214
|
-
"tag": "h1",
|
|
215
|
-
"attrs": null,
|
|
216
|
-
"map": null,
|
|
217
|
-
"nesting": -1,
|
|
218
|
-
"level": 0,
|
|
219
|
-
"children": null,
|
|
220
|
-
"content": "",
|
|
221
|
-
"markup": "#",
|
|
222
|
-
"info": "",
|
|
223
|
-
"meta": null,
|
|
224
|
-
"block": true,
|
|
225
|
-
"hidden": false
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
"type": "paragraph_open",
|
|
229
|
-
"tag": "p",
|
|
230
|
-
"attrs": null,
|
|
231
|
-
"map": [ 2, 3 ],
|
|
232
|
-
"nesting": 1,
|
|
233
|
-
"level": 0,
|
|
234
|
-
"children": null,
|
|
235
|
-
"content": "",
|
|
236
|
-
"markup": "",
|
|
237
|
-
"info": "",
|
|
238
|
-
"meta": null,
|
|
239
|
-
"block": true,
|
|
240
|
-
"hidden": false,
|
|
241
|
-
"line": "Text *text* text.",
|
|
242
|
-
"lineNumber": 3
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
"type": "inline",
|
|
246
|
-
"tag": "",
|
|
247
|
-
"attrs": null,
|
|
248
|
-
"map": [ 2, 3 ],
|
|
249
|
-
"nesting": 0,
|
|
250
|
-
"level": 1,
|
|
251
|
-
"children": [
|
|
252
|
-
{
|
|
253
|
-
"type": "text",
|
|
254
|
-
"tag": "",
|
|
255
|
-
"attrs": null,
|
|
256
|
-
"map": null,
|
|
257
|
-
"nesting": 0,
|
|
258
|
-
"level": 0,
|
|
259
|
-
"children": null,
|
|
260
|
-
"content": "Text ",
|
|
261
|
-
"markup": "",
|
|
262
|
-
"info": "",
|
|
263
|
-
"meta": null,
|
|
264
|
-
"block": false,
|
|
265
|
-
"hidden": false,
|
|
266
|
-
"lineNumber": 3,
|
|
267
|
-
"line": "Text *text* text."
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
"type": "em_open",
|
|
271
|
-
"tag": "em",
|
|
272
|
-
"attrs": null,
|
|
273
|
-
"map": null,
|
|
274
|
-
"nesting": 1,
|
|
275
|
-
"level": 1,
|
|
276
|
-
"children": null,
|
|
277
|
-
"content": "",
|
|
278
|
-
"markup": "*",
|
|
279
|
-
"info": "",
|
|
280
|
-
"meta": null,
|
|
281
|
-
"block": false,
|
|
282
|
-
"hidden": false,
|
|
283
|
-
"lineNumber": 3,
|
|
284
|
-
"line": "Text *text* text."
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
"type": "text",
|
|
288
|
-
"tag": "",
|
|
289
|
-
"attrs": null,
|
|
290
|
-
"map": null,
|
|
291
|
-
"nesting": 0,
|
|
292
|
-
"level": 1,
|
|
293
|
-
"children": null,
|
|
294
|
-
"content": "text",
|
|
295
|
-
"markup": "",
|
|
296
|
-
"info": "",
|
|
297
|
-
"meta": null,
|
|
298
|
-
"block": false,
|
|
299
|
-
"hidden": false,
|
|
300
|
-
"lineNumber": 3,
|
|
301
|
-
"line": "Text *text* text."
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
"type": "em_close",
|
|
305
|
-
"tag": "em",
|
|
306
|
-
"attrs": null,
|
|
307
|
-
"map": null,
|
|
308
|
-
"nesting": -1,
|
|
309
|
-
"level": 0,
|
|
310
|
-
"children": null,
|
|
311
|
-
"content": "",
|
|
312
|
-
"markup": "*",
|
|
313
|
-
"info": "",
|
|
314
|
-
"meta": null,
|
|
315
|
-
"block": false,
|
|
316
|
-
"hidden": false,
|
|
317
|
-
"lineNumber": 3,
|
|
318
|
-
"line": "Text *text* text."
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
"type": "text",
|
|
322
|
-
"tag": "",
|
|
323
|
-
"attrs": null,
|
|
324
|
-
"map": null,
|
|
325
|
-
"nesting": 0,
|
|
326
|
-
"level": 0,
|
|
327
|
-
"children": null,
|
|
328
|
-
"content": " text.",
|
|
329
|
-
"markup": "",
|
|
330
|
-
"info": "",
|
|
331
|
-
"meta": null,
|
|
332
|
-
"block": false,
|
|
333
|
-
"hidden": false,
|
|
334
|
-
"lineNumber": 3,
|
|
335
|
-
"line": "Text *text* text."
|
|
336
|
-
}
|
|
337
|
-
],
|
|
338
|
-
"content": "Text *text* text.",
|
|
339
|
-
"markup": "",
|
|
340
|
-
"info": "",
|
|
341
|
-
"meta": null,
|
|
342
|
-
"block": true,
|
|
343
|
-
"hidden": false,
|
|
344
|
-
"line": "Text *text* text.",
|
|
345
|
-
"lineNumber": 3
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
"type": "paragraph_close",
|
|
349
|
-
"tag": "p",
|
|
350
|
-
"attrs": null,
|
|
351
|
-
"map": null,
|
|
352
|
-
"nesting": -1,
|
|
353
|
-
"level": 0,
|
|
354
|
-
"children": null,
|
|
355
|
-
"content": "",
|
|
356
|
-
"markup": "",
|
|
357
|
-
"info": "",
|
|
358
|
-
"meta": null,
|
|
359
|
-
"block": true,
|
|
360
|
-
"hidden": false
|
|
361
|
-
}
|
|
362
|
-
],
|
|
363
|
-
"lines": [
|
|
364
|
-
"# Title",
|
|
365
|
-
"",
|
|
366
|
-
"Text *text* text.",
|
|
367
|
-
""
|
|
368
|
-
],
|
|
369
|
-
"frontMatterLines": [],
|
|
370
|
-
"config": {
|
|
371
|
-
"customValue1": "abc",
|
|
372
|
-
"customValue2": 123
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
```
|
|
376
|
-
|
|
377
180
|
[commonmark]: https://commonmark.org/
|
|
378
181
|
[electron]: https://github.com/electron/lint-roller/tree/main/markdownlint-rules
|
|
379
182
|
[extended-ascii]: https://github.com/DavidAnson/markdownlint-rule-extended-ascii
|
|
@@ -383,6 +186,9 @@ Yields the `params` object:
|
|
|
383
186
|
[markdown-it]: https://github.com/markdown-it/markdown-it
|
|
384
187
|
[markdown-it-token]: https://markdown-it.github.io/markdown-it/#Token
|
|
385
188
|
[markdownlint-rule]: https://www.npmjs.com/search?q=keywords:markdownlint-rule
|
|
189
|
+
[micromark]: https://github.com/micromark/micromark
|
|
190
|
+
[micromark-token]: ../lib/markdownlint.d.ts
|
|
386
191
|
[rule-helpers]: https://www.npmjs.com/package/markdownlint-rule-helpers
|
|
387
192
|
[options-custom-rules]: ../README.md#optionscustomrules
|
|
388
193
|
[test-rules]: ../test/rules
|
|
194
|
+
[tokens]: ../test/snapshots/markdownlint-test-custom-rules.js.md
|
package/doc/Rules.md
CHANGED
|
@@ -93,8 +93,8 @@ Setext style H2
|
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
Note: The configured heading style can be a specific style to require (`atx`,
|
|
96
|
-
`atx_closed`, `setext`, `setext_with_atx`, `setext_with_atx_closed`), or
|
|
97
|
-
|
|
96
|
+
`atx_closed`, `setext`, `setext_with_atx`, `setext_with_atx_closed`), or can
|
|
97
|
+
require that all heading styles match the first heading style via `consistent`.
|
|
98
98
|
|
|
99
99
|
Note: The placement of a horizontal rule directly below a line of text can
|
|
100
100
|
trigger this rule by turning that text into a level 2 setext-style heading:
|
|
@@ -139,9 +139,10 @@ document:
|
|
|
139
139
|
* Item 3
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
-
The configured list style can
|
|
143
|
-
dash),
|
|
144
|
-
|
|
142
|
+
The configured list style can ensure all list styling is a specific symbol
|
|
143
|
+
(`asterisk`, `plus`, `dash`), ensure each sublist has a consistent symbol that
|
|
144
|
+
differs from its parent list (`sublist`), or ensure all list styles match the
|
|
145
|
+
first list style (`consistent`).
|
|
145
146
|
|
|
146
147
|
For example, the following is valid for the `sublist` style because the
|
|
147
148
|
outer-most indent uses asterisk, the middle indent uses plus, and the inner-most
|
|
@@ -1416,8 +1417,7 @@ in the document:
|
|
|
1416
1417
|
****
|
|
1417
1418
|
```
|
|
1418
1419
|
|
|
1419
|
-
To fix this,
|
|
1420
|
-
or match the given style if the rule is so configured:
|
|
1420
|
+
To fix this, use the same horizontal rule everywhere:
|
|
1421
1421
|
|
|
1422
1422
|
```markdown
|
|
1423
1423
|
---
|
|
@@ -1425,12 +1425,8 @@ or match the given style if the rule is so configured:
|
|
|
1425
1425
|
---
|
|
1426
1426
|
```
|
|
1427
1427
|
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
rules are different than the first one encountered in the document. If you
|
|
1431
|
-
want to configure the rule to match a specific style, the parameter given to
|
|
1432
|
-
the 'style' option is a string containing the exact horizontal rule text that
|
|
1433
|
-
is allowed.
|
|
1428
|
+
The configured style can ensure all horizontal rules use a specific string or it
|
|
1429
|
+
can ensure all horizontal rules match the first horizontal rule (`consistent`).
|
|
1434
1430
|
|
|
1435
1431
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1436
1432
|
|
|
@@ -1932,8 +1928,8 @@ document:
|
|
|
1932
1928
|
To fix violations of this rule, use a consistent style (either indenting or code
|
|
1933
1929
|
fences).
|
|
1934
1930
|
|
|
1935
|
-
The
|
|
1936
|
-
|
|
1931
|
+
The configured code block style can be specific (`fenced`, `indented`) or can
|
|
1932
|
+
require all code blocks match the first code block (`consistent`).
|
|
1937
1933
|
|
|
1938
1934
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
1939
1935
|
|
|
@@ -2013,8 +2009,9 @@ document:
|
|
|
2013
2009
|
```
|
|
2014
2010
|
````
|
|
2015
2011
|
|
|
2016
|
-
The configured
|
|
2017
|
-
can require
|
|
2012
|
+
The configured code fence style can be a specific symbol to use (`backtick`,
|
|
2013
|
+
`tilde`) or it can require all code fences match the first code fence
|
|
2014
|
+
(`consistent`).
|
|
2018
2015
|
|
|
2019
2016
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
2020
2017
|
|
|
@@ -2048,10 +2045,11 @@ To fix this issue, use the configured emphasis style throughout the document:
|
|
|
2048
2045
|
*Text*
|
|
2049
2046
|
```
|
|
2050
2047
|
|
|
2051
|
-
The configured emphasis style can be a specific symbol to use (
|
|
2052
|
-
|
|
2048
|
+
The configured emphasis style can be a specific symbol to use (`asterisk`,
|
|
2049
|
+
`underscore`) or can require all emphasis matches the first emphasis
|
|
2050
|
+
(`consistent`).
|
|
2053
2051
|
|
|
2054
|
-
Note: Emphasis within a word is restricted to
|
|
2052
|
+
Note: Emphasis within a word is restricted to `asterisk` in order to avoid
|
|
2055
2053
|
unwanted emphasis for words containing internal underscores like_this_one.
|
|
2056
2054
|
|
|
2057
2055
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
@@ -2086,11 +2084,11 @@ To fix this issue, use the configured strong style throughout the document:
|
|
|
2086
2084
|
**Text**
|
|
2087
2085
|
```
|
|
2088
2086
|
|
|
2089
|
-
The configured strong style can be a specific symbol to use (
|
|
2090
|
-
|
|
2087
|
+
The configured strong style can be a specific symbol to use (`asterisk`,
|
|
2088
|
+
`underscore`) or can require all strong matches the first strong (`consistent`).
|
|
2091
2089
|
|
|
2092
|
-
Note: Emphasis within a word is restricted to
|
|
2093
|
-
unwanted emphasis for words containing internal underscores
|
|
2090
|
+
Note: Emphasis within a word is restricted to `asterisk` in order to avoid
|
|
2091
|
+
unwanted emphasis for words containing internal underscores like__this__one.
|
|
2094
2092
|
|
|
2095
2093
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
2096
2094
|
|
|
@@ -2102,6 +2100,10 @@ Tags: `links`
|
|
|
2102
2100
|
|
|
2103
2101
|
Aliases: `link-fragments`
|
|
2104
2102
|
|
|
2103
|
+
Parameters:
|
|
2104
|
+
|
|
2105
|
+
- `ignore_case`: Ignore case of fragments (`boolean`, default `false`)
|
|
2106
|
+
|
|
2105
2107
|
Fixable: Some violations can be fixed by tooling
|
|
2106
2108
|
|
|
2107
2109
|
This rule is triggered when a link fragment does not match any of the fragments
|
|
@@ -2122,9 +2124,9 @@ generated name (see below):
|
|
|
2122
2124
|
[Link](#heading-name)
|
|
2123
2125
|
```
|
|
2124
2126
|
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
Therefore, the following example is reported as a violation:
|
|
2127
|
+
For consistency, this rule requires fragments to exactly match the [GitHub
|
|
2128
|
+
heading algorithm][github-heading-algorithm] which converts letters to
|
|
2129
|
+
lowercase. Therefore, the following example is reported as a violation:
|
|
2128
2130
|
|
|
2129
2131
|
```markdown
|
|
2130
2132
|
# Heading Name
|
|
@@ -2132,6 +2134,10 @@ Therefore, the following example is reported as a violation:
|
|
|
2132
2134
|
[Link](#Heading-Name)
|
|
2133
2135
|
```
|
|
2134
2136
|
|
|
2137
|
+
To ignore case when comparing fragments with heading names, the `ignore_case`
|
|
2138
|
+
parameter can be set to `true`. In this configuration, the previous example is
|
|
2139
|
+
not reported as a violation.
|
|
2140
|
+
|
|
2135
2141
|
Alternatively, some platforms allow the syntax `{#named-anchor}` to be used
|
|
2136
2142
|
within a heading to provide a specific name (consisting of only lower-case
|
|
2137
2143
|
letters, numbers, `-`, and `_`):
|
|
@@ -2389,8 +2395,9 @@ This rule is triggered when a [GitHub Flavored Markdown table][gfm-table-055]
|
|
|
2389
2395
|
is inconsistent about its use of leading and trailing pipe characters (`|`).
|
|
2390
2396
|
|
|
2391
2397
|
By default (`consistent` style), the header row of the first table in a document
|
|
2392
|
-
is used to determine the style that is enforced for
|
|
2393
|
-
A specific style can be
|
|
2398
|
+
is used to determine the style that is enforced for every table in the document.
|
|
2399
|
+
A specific style can be used instead (`leading_and_trailing`, `leading_only`,
|
|
2400
|
+
`no_leading_or_trailing`, `trailing_only`).
|
|
2394
2401
|
|
|
2395
2402
|
This table's header row has leading and trailing pipes, but its delimiter row is
|
|
2396
2403
|
missing the trailing pipe and its first row of cells is missing the leading
|
package/doc/md003.md
CHANGED
|
@@ -45,8 +45,8 @@ Setext style H2
|
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
Note: The configured heading style can be a specific style to require (`atx`,
|
|
48
|
-
`atx_closed`, `setext`, `setext_with_atx`, `setext_with_atx_closed`), or
|
|
49
|
-
|
|
48
|
+
`atx_closed`, `setext`, `setext_with_atx`, `setext_with_atx_closed`), or can
|
|
49
|
+
require that all heading styles match the first heading style via `consistent`.
|
|
50
50
|
|
|
51
51
|
Note: The placement of a horizontal rule directly below a line of text can
|
|
52
52
|
trigger this rule by turning that text into a level 2 setext-style heading:
|
package/doc/md004.md
CHANGED
|
@@ -29,9 +29,10 @@ document:
|
|
|
29
29
|
* Item 3
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
The configured list style can
|
|
33
|
-
dash),
|
|
34
|
-
|
|
32
|
+
The configured list style can ensure all list styling is a specific symbol
|
|
33
|
+
(`asterisk`, `plus`, `dash`), ensure each sublist has a consistent symbol that
|
|
34
|
+
differs from its parent list (`sublist`), or ensure all list styles match the
|
|
35
|
+
first list style (`consistent`).
|
|
35
36
|
|
|
36
37
|
For example, the following is valid for the `sublist` style because the
|
|
37
38
|
outer-most indent uses asterisk, the middle indent uses plus, and the inner-most
|
package/doc/md035.md
CHANGED
|
@@ -23,8 +23,7 @@ in the document:
|
|
|
23
23
|
****
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
To fix this,
|
|
27
|
-
or match the given style if the rule is so configured:
|
|
26
|
+
To fix this, use the same horizontal rule everywhere:
|
|
28
27
|
|
|
29
28
|
```markdown
|
|
30
29
|
---
|
|
@@ -32,11 +31,7 @@ or match the given style if the rule is so configured:
|
|
|
32
31
|
---
|
|
33
32
|
```
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
rules are different than the first one encountered in the document. If you
|
|
38
|
-
want to configure the rule to match a specific style, the parameter given to
|
|
39
|
-
the 'style' option is a string containing the exact horizontal rule text that
|
|
40
|
-
is allowed.
|
|
34
|
+
The configured style can ensure all horizontal rules use a specific string or it
|
|
35
|
+
can ensure all horizontal rules match the first horizontal rule (`consistent`).
|
|
41
36
|
|
|
42
37
|
Rationale: Consistent formatting makes it easier to understand a document.
|
package/doc/md046.md
CHANGED
|
@@ -34,7 +34,7 @@ document:
|
|
|
34
34
|
To fix violations of this rule, use a consistent style (either indenting or code
|
|
35
35
|
fences).
|
|
36
36
|
|
|
37
|
-
The
|
|
38
|
-
|
|
37
|
+
The configured code block style can be specific (`fenced`, `indented`) or can
|
|
38
|
+
require all code blocks match the first code block (`consistent`).
|
|
39
39
|
|
|
40
40
|
Rationale: Consistent formatting makes it easier to understand a document.
|
package/doc/md048.md
CHANGED
|
@@ -35,7 +35,8 @@ document:
|
|
|
35
35
|
```
|
|
36
36
|
````
|
|
37
37
|
|
|
38
|
-
The configured
|
|
39
|
-
can require
|
|
38
|
+
The configured code fence style can be a specific symbol to use (`backtick`,
|
|
39
|
+
`tilde`) or it can require all code fences match the first code fence
|
|
40
|
+
(`consistent`).
|
|
40
41
|
|
|
41
42
|
Rationale: Consistent formatting makes it easier to understand a document.
|
package/doc/md049.md
CHANGED
|
@@ -26,10 +26,11 @@ To fix this issue, use the configured emphasis style throughout the document:
|
|
|
26
26
|
*Text*
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
The configured emphasis style can be a specific symbol to use (
|
|
30
|
-
|
|
29
|
+
The configured emphasis style can be a specific symbol to use (`asterisk`,
|
|
30
|
+
`underscore`) or can require all emphasis matches the first emphasis
|
|
31
|
+
(`consistent`).
|
|
31
32
|
|
|
32
|
-
Note: Emphasis within a word is restricted to
|
|
33
|
+
Note: Emphasis within a word is restricted to `asterisk` in order to avoid
|
|
33
34
|
unwanted emphasis for words containing internal underscores like_this_one.
|
|
34
35
|
|
|
35
36
|
Rationale: Consistent formatting makes it easier to understand a document.
|
package/doc/md050.md
CHANGED
|
@@ -26,10 +26,10 @@ To fix this issue, use the configured strong style throughout the document:
|
|
|
26
26
|
**Text**
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
The configured strong style can be a specific symbol to use (
|
|
30
|
-
|
|
29
|
+
The configured strong style can be a specific symbol to use (`asterisk`,
|
|
30
|
+
`underscore`) or can require all strong matches the first strong (`consistent`).
|
|
31
31
|
|
|
32
|
-
Note: Emphasis within a word is restricted to
|
|
33
|
-
unwanted emphasis for words containing internal underscores
|
|
32
|
+
Note: Emphasis within a word is restricted to `asterisk` in order to avoid
|
|
33
|
+
unwanted emphasis for words containing internal underscores like__this__one.
|
|
34
34
|
|
|
35
35
|
Rationale: Consistent formatting makes it easier to understand a document.
|
package/doc/md051.md
CHANGED
|
@@ -4,6 +4,10 @@ Tags: `links`
|
|
|
4
4
|
|
|
5
5
|
Aliases: `link-fragments`
|
|
6
6
|
|
|
7
|
+
Parameters:
|
|
8
|
+
|
|
9
|
+
- `ignore_case`: Ignore case of fragments (`boolean`, default `false`)
|
|
10
|
+
|
|
7
11
|
Fixable: Some violations can be fixed by tooling
|
|
8
12
|
|
|
9
13
|
This rule is triggered when a link fragment does not match any of the fragments
|
|
@@ -24,9 +28,9 @@ generated name (see below):
|
|
|
24
28
|
[Link](#heading-name)
|
|
25
29
|
```
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Therefore, the following example is reported as a violation:
|
|
31
|
+
For consistency, this rule requires fragments to exactly match the [GitHub
|
|
32
|
+
heading algorithm][github-heading-algorithm] which converts letters to
|
|
33
|
+
lowercase. Therefore, the following example is reported as a violation:
|
|
30
34
|
|
|
31
35
|
```markdown
|
|
32
36
|
# Heading Name
|
|
@@ -34,6 +38,10 @@ Therefore, the following example is reported as a violation:
|
|
|
34
38
|
[Link](#Heading-Name)
|
|
35
39
|
```
|
|
36
40
|
|
|
41
|
+
To ignore case when comparing fragments with heading names, the `ignore_case`
|
|
42
|
+
parameter can be set to `true`. In this configuration, the previous example is
|
|
43
|
+
not reported as a violation.
|
|
44
|
+
|
|
37
45
|
Alternatively, some platforms allow the syntax `{#named-anchor}` to be used
|
|
38
46
|
within a heading to provide a specific name (consisting of only lower-case
|
|
39
47
|
letters, numbers, `-`, and `_`):
|
package/doc/md055.md
CHANGED
|
@@ -14,8 +14,9 @@ This rule is triggered when a [GitHub Flavored Markdown table][gfm-table-055]
|
|
|
14
14
|
is inconsistent about its use of leading and trailing pipe characters (`|`).
|
|
15
15
|
|
|
16
16
|
By default (`consistent` style), the header row of the first table in a document
|
|
17
|
-
is used to determine the style that is enforced for
|
|
18
|
-
A specific style can be
|
|
17
|
+
is used to determine the style that is enforced for every table in the document.
|
|
18
|
+
A specific style can be used instead (`leading_and_trailing`, `leading_only`,
|
|
19
|
+
`no_leading_or_trailing`, `trailing_only`).
|
|
19
20
|
|
|
20
21
|
This table's header row has leading and trailing pipes, but its delimiter row is
|
|
21
22
|
missing the trailing pipe and its first row of cells is missing the leading
|