markdownlint 0.22.0 → 0.25.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.
- package/CONTRIBUTING.md +13 -3
- package/LICENSE +1 -1
- package/README.md +140 -83
- package/demo/markdownlint-browser.js +1599 -3309
- package/doc/CustomRules.md +15 -4
- package/doc/Prettier.md +23 -0
- package/doc/Rules.md +191 -80
- package/helpers/LICENSE +1 -1
- package/helpers/helpers.js +260 -68
- package/helpers/package.json +1 -1
- package/lib/cache.js +14 -5
- package/lib/constants.js +7 -0
- package/lib/markdownlint.d.ts +31 -11
- package/lib/markdownlint.js +336 -254
- package/lib/md002.js +1 -1
- package/lib/md004.js +46 -13
- package/lib/md006.js +1 -1
- package/lib/md007.js +4 -2
- package/lib/md009.js +24 -20
- package/lib/md010.js +25 -16
- package/lib/md011.js +31 -27
- package/lib/md018.js +1 -1
- package/lib/md019.js +1 -1
- package/lib/md020.js +1 -1
- package/lib/md021.js +1 -1
- package/lib/md023.js +1 -1
- package/lib/md025.js +1 -1
- package/lib/md032.js +2 -2
- package/lib/md033.js +12 -8
- package/lib/md035.js +4 -4
- package/lib/md037.js +40 -12
- package/lib/md039.js +4 -3
- package/lib/md041.js +14 -3
- package/lib/md043.js +9 -5
- package/lib/md044.js +54 -71
- package/lib/md049.js +45 -0
- package/lib/md050.js +45 -0
- package/lib/rules.js +6 -5
- package/package.json +46 -37
- package/schema/.markdownlint.jsonc +266 -0
- package/schema/.markdownlint.yaml +239 -0
- package/schema/markdownlint-config-schema.json +129 -22
- package/schema/build-config-schema.js +0 -417
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
"use strict";
|
|
4
|
-
|
|
5
|
-
const fs = require("fs");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const rules = require("../lib/rules");
|
|
8
|
-
|
|
9
|
-
// Schema scaffolding
|
|
10
|
-
const schema = {
|
|
11
|
-
"title": "Markdownlint configuration schema",
|
|
12
|
-
"type": "object",
|
|
13
|
-
"properties": {
|
|
14
|
-
"default": {
|
|
15
|
-
"description": "Default state for all rules",
|
|
16
|
-
"type": "boolean",
|
|
17
|
-
"default": true
|
|
18
|
-
},
|
|
19
|
-
"extends": {
|
|
20
|
-
"description": "Path to configuration file to extend",
|
|
21
|
-
"type": "string",
|
|
22
|
-
"default": null
|
|
23
|
-
},
|
|
24
|
-
"$schema": {
|
|
25
|
-
"description": "JSON Schema URI (used by some editors)",
|
|
26
|
-
"type": "string",
|
|
27
|
-
"default": "https://raw.githubusercontent.com/DavidAnson/markdownlint" +
|
|
28
|
-
"/main/schema/markdownlint-config-schema.json"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"additionalProperties": {
|
|
32
|
-
"type:": [
|
|
33
|
-
"boolean",
|
|
34
|
-
"object"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const tags = {};
|
|
39
|
-
|
|
40
|
-
// Add rules
|
|
41
|
-
rules.forEach(function forRule(rule) {
|
|
42
|
-
rule.tags.forEach(function forTag(tag) {
|
|
43
|
-
const tagRules = tags[tag] || [];
|
|
44
|
-
tagRules.push(rule.names[0]);
|
|
45
|
-
tags[tag] = tagRules;
|
|
46
|
-
});
|
|
47
|
-
const scheme = {
|
|
48
|
-
"description": rule.names.join("/") + " - " + rule.description,
|
|
49
|
-
"type": "boolean",
|
|
50
|
-
"default": true
|
|
51
|
-
};
|
|
52
|
-
let custom = true;
|
|
53
|
-
switch (rule.names[0]) {
|
|
54
|
-
case "MD002":
|
|
55
|
-
scheme.properties = {
|
|
56
|
-
"level": {
|
|
57
|
-
"description": "Heading level",
|
|
58
|
-
"type": "integer",
|
|
59
|
-
"default": 1
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
break;
|
|
63
|
-
case "MD003":
|
|
64
|
-
scheme.properties = {
|
|
65
|
-
"style": {
|
|
66
|
-
"description": "Heading style",
|
|
67
|
-
"type": "string",
|
|
68
|
-
"enum": [
|
|
69
|
-
"consistent",
|
|
70
|
-
"atx",
|
|
71
|
-
"atx_closed",
|
|
72
|
-
"setext",
|
|
73
|
-
"setext_with_atx",
|
|
74
|
-
"setext_with_atx_closed"
|
|
75
|
-
],
|
|
76
|
-
"default": "consistent"
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
break;
|
|
80
|
-
case "MD004":
|
|
81
|
-
scheme.properties = {
|
|
82
|
-
"style": {
|
|
83
|
-
"description": "List style",
|
|
84
|
-
"type": "string",
|
|
85
|
-
"enum": [
|
|
86
|
-
"consistent",
|
|
87
|
-
"asterisk",
|
|
88
|
-
"plus",
|
|
89
|
-
"dash",
|
|
90
|
-
"sublist"
|
|
91
|
-
],
|
|
92
|
-
"default": "consistent"
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
break;
|
|
96
|
-
case "MD007":
|
|
97
|
-
scheme.properties = {
|
|
98
|
-
"indent": {
|
|
99
|
-
"description": "Spaces for indent",
|
|
100
|
-
"type": "integer",
|
|
101
|
-
"default": 2
|
|
102
|
-
},
|
|
103
|
-
"start_indented": {
|
|
104
|
-
"description": "Whether to indent the first level of the list",
|
|
105
|
-
"type": "boolean",
|
|
106
|
-
"default": false
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
break;
|
|
110
|
-
case "MD009":
|
|
111
|
-
scheme.properties = {
|
|
112
|
-
"br_spaces": {
|
|
113
|
-
"description": "Spaces for line break",
|
|
114
|
-
"type": "integer",
|
|
115
|
-
"default": 2
|
|
116
|
-
},
|
|
117
|
-
"list_item_empty_lines": {
|
|
118
|
-
"description": "Allow spaces for empty lines in list items",
|
|
119
|
-
"type": "boolean",
|
|
120
|
-
"default": false
|
|
121
|
-
},
|
|
122
|
-
"strict": {
|
|
123
|
-
"description": "Include unnecessary breaks",
|
|
124
|
-
"type": "boolean",
|
|
125
|
-
"default": false
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
break;
|
|
129
|
-
case "MD010":
|
|
130
|
-
scheme.properties = {
|
|
131
|
-
"code_blocks": {
|
|
132
|
-
"description": "Include code blocks",
|
|
133
|
-
"type": "boolean",
|
|
134
|
-
"default": true
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
break;
|
|
138
|
-
case "MD012":
|
|
139
|
-
scheme.properties = {
|
|
140
|
-
"maximum": {
|
|
141
|
-
"description": "Consecutive blank lines",
|
|
142
|
-
"type": "integer",
|
|
143
|
-
"default": 1
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
break;
|
|
147
|
-
case "MD013":
|
|
148
|
-
scheme.properties = {
|
|
149
|
-
"line_length": {
|
|
150
|
-
"description": "Number of characters",
|
|
151
|
-
"type": "integer",
|
|
152
|
-
"default": 80
|
|
153
|
-
},
|
|
154
|
-
"heading_line_length": {
|
|
155
|
-
"description": "Number of characters for headings",
|
|
156
|
-
"type": "integer",
|
|
157
|
-
"default": 80
|
|
158
|
-
},
|
|
159
|
-
"code_block_line_length": {
|
|
160
|
-
"description": "Number of characters for code blocks",
|
|
161
|
-
"type": "integer",
|
|
162
|
-
"default": 80
|
|
163
|
-
},
|
|
164
|
-
"code_blocks": {
|
|
165
|
-
"description": "Include code blocks",
|
|
166
|
-
"type": "boolean",
|
|
167
|
-
"default": true
|
|
168
|
-
},
|
|
169
|
-
"tables": {
|
|
170
|
-
"description": "Include tables",
|
|
171
|
-
"type": "boolean",
|
|
172
|
-
"default": true
|
|
173
|
-
},
|
|
174
|
-
"headings": {
|
|
175
|
-
"description": "Include headings",
|
|
176
|
-
"type": "boolean",
|
|
177
|
-
"default": true
|
|
178
|
-
},
|
|
179
|
-
"headers": {
|
|
180
|
-
"description": "Include headings",
|
|
181
|
-
"type": "boolean",
|
|
182
|
-
"default": true
|
|
183
|
-
},
|
|
184
|
-
"strict": {
|
|
185
|
-
"description": "Strict length checking",
|
|
186
|
-
"type": "boolean",
|
|
187
|
-
"default": false
|
|
188
|
-
},
|
|
189
|
-
"stern": {
|
|
190
|
-
"description": "Stern length checking",
|
|
191
|
-
"type": "boolean",
|
|
192
|
-
"default": false
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
break;
|
|
196
|
-
case "MD022":
|
|
197
|
-
scheme.properties = {
|
|
198
|
-
"lines_above": {
|
|
199
|
-
"description": "Blank lines above heading",
|
|
200
|
-
"type": "integer",
|
|
201
|
-
"default": 1
|
|
202
|
-
},
|
|
203
|
-
"lines_below": {
|
|
204
|
-
"description": "Blank lines below heading",
|
|
205
|
-
"type": "integer",
|
|
206
|
-
"default": 1
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
break;
|
|
210
|
-
case "MD024":
|
|
211
|
-
scheme.properties = {
|
|
212
|
-
"allow_different_nesting": {
|
|
213
|
-
"description": "Only check sibling headings",
|
|
214
|
-
"type": "boolean",
|
|
215
|
-
"default": false
|
|
216
|
-
},
|
|
217
|
-
"siblings_only": {
|
|
218
|
-
"description": "Only check sibling headings",
|
|
219
|
-
"type": "boolean",
|
|
220
|
-
"default": false
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
break;
|
|
224
|
-
case "MD026":
|
|
225
|
-
scheme.properties = {
|
|
226
|
-
"punctuation": {
|
|
227
|
-
"description": "Punctuation characters",
|
|
228
|
-
"type": "string",
|
|
229
|
-
"default": ".,;:!。,;:!"
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
break;
|
|
233
|
-
case "MD036":
|
|
234
|
-
scheme.properties = {
|
|
235
|
-
"punctuation": {
|
|
236
|
-
"description": "Punctuation characters",
|
|
237
|
-
"type": "string",
|
|
238
|
-
"default": ".,;:!?。,;:!?"
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
break;
|
|
242
|
-
case "MD029":
|
|
243
|
-
scheme.properties = {
|
|
244
|
-
"style": {
|
|
245
|
-
"description": "List style",
|
|
246
|
-
"type": "string",
|
|
247
|
-
"enum": [
|
|
248
|
-
"one",
|
|
249
|
-
"ordered",
|
|
250
|
-
"one_or_ordered",
|
|
251
|
-
"zero"
|
|
252
|
-
],
|
|
253
|
-
"default": "one_or_ordered"
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
break;
|
|
257
|
-
case "MD030":
|
|
258
|
-
scheme.properties = {
|
|
259
|
-
"ul_single": {
|
|
260
|
-
"description": "Spaces for single-line unordered list items",
|
|
261
|
-
"type": "integer",
|
|
262
|
-
"default": 1
|
|
263
|
-
},
|
|
264
|
-
"ol_single": {
|
|
265
|
-
"description": "Spaces for single-line ordered list items",
|
|
266
|
-
"type": "integer",
|
|
267
|
-
"default": 1
|
|
268
|
-
},
|
|
269
|
-
"ul_multi": {
|
|
270
|
-
"description": "Spaces for multi-line unordered list items",
|
|
271
|
-
"type": "integer",
|
|
272
|
-
"default": 1
|
|
273
|
-
},
|
|
274
|
-
"ol_multi": {
|
|
275
|
-
"description": "Spaces for multi-line ordered list items",
|
|
276
|
-
"type": "integer",
|
|
277
|
-
"default": 1
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
break;
|
|
281
|
-
case "MD031":
|
|
282
|
-
scheme.properties = {
|
|
283
|
-
"list_items": {
|
|
284
|
-
"description": "Include list items",
|
|
285
|
-
"type": "boolean",
|
|
286
|
-
"default": true
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
break;
|
|
290
|
-
case "MD033":
|
|
291
|
-
scheme.properties = {
|
|
292
|
-
"allowed_elements": {
|
|
293
|
-
"description": "Allowed elements",
|
|
294
|
-
"type": "array",
|
|
295
|
-
"items": {
|
|
296
|
-
"type": "string"
|
|
297
|
-
},
|
|
298
|
-
"default": []
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
break;
|
|
302
|
-
case "MD035":
|
|
303
|
-
scheme.properties = {
|
|
304
|
-
"style": {
|
|
305
|
-
"description": "Horizontal rule style",
|
|
306
|
-
"type": "string",
|
|
307
|
-
"default": "consistent"
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
break;
|
|
311
|
-
case "MD025":
|
|
312
|
-
case "MD041":
|
|
313
|
-
scheme.properties = {
|
|
314
|
-
"level": {
|
|
315
|
-
"description": "Heading level",
|
|
316
|
-
"type": "integer",
|
|
317
|
-
"default": 1
|
|
318
|
-
},
|
|
319
|
-
"front_matter_title": {
|
|
320
|
-
"description": "RegExp for matching title in front matter",
|
|
321
|
-
"type": "string",
|
|
322
|
-
"default": "^\\s*title\\s*[:=]"
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
break;
|
|
326
|
-
case "MD043":
|
|
327
|
-
scheme.properties = {
|
|
328
|
-
"headings": {
|
|
329
|
-
"description": "List of headings",
|
|
330
|
-
"type": "array",
|
|
331
|
-
"items": {
|
|
332
|
-
"type": "string"
|
|
333
|
-
},
|
|
334
|
-
"default": null
|
|
335
|
-
},
|
|
336
|
-
"headers": {
|
|
337
|
-
"description": "List of headings",
|
|
338
|
-
"type": "array",
|
|
339
|
-
"items": {
|
|
340
|
-
"type": "string"
|
|
341
|
-
},
|
|
342
|
-
"default": null
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
break;
|
|
346
|
-
case "MD044":
|
|
347
|
-
scheme.properties = {
|
|
348
|
-
"names": {
|
|
349
|
-
"description": "List of proper names",
|
|
350
|
-
"type": "array",
|
|
351
|
-
"items": {
|
|
352
|
-
"type": "string"
|
|
353
|
-
},
|
|
354
|
-
"default": null
|
|
355
|
-
},
|
|
356
|
-
"code_blocks": {
|
|
357
|
-
"description": "Include code blocks",
|
|
358
|
-
"type": "boolean",
|
|
359
|
-
"default": true
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
break;
|
|
363
|
-
case "MD046":
|
|
364
|
-
scheme.properties = {
|
|
365
|
-
"style": {
|
|
366
|
-
"description": "Block style",
|
|
367
|
-
"type": "string",
|
|
368
|
-
"enum": [
|
|
369
|
-
"consistent",
|
|
370
|
-
"fenced",
|
|
371
|
-
"indented"
|
|
372
|
-
],
|
|
373
|
-
"default": "consistent"
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
break;
|
|
377
|
-
case "MD048":
|
|
378
|
-
scheme.properties = {
|
|
379
|
-
"style": {
|
|
380
|
-
"description": "Code fence syle",
|
|
381
|
-
"type": "string",
|
|
382
|
-
"enum": [
|
|
383
|
-
"consistent",
|
|
384
|
-
"backtick",
|
|
385
|
-
"tilde"
|
|
386
|
-
],
|
|
387
|
-
"default": "consistent"
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
break;
|
|
391
|
-
default:
|
|
392
|
-
custom = false;
|
|
393
|
-
break;
|
|
394
|
-
}
|
|
395
|
-
if (custom) {
|
|
396
|
-
// @ts-ignore
|
|
397
|
-
scheme.type = [ "boolean", "object" ];
|
|
398
|
-
scheme.additionalProperties = false;
|
|
399
|
-
}
|
|
400
|
-
rule.names.forEach(function forName(name) {
|
|
401
|
-
schema.properties[name] = scheme;
|
|
402
|
-
});
|
|
403
|
-
});
|
|
404
|
-
|
|
405
|
-
// Add tags
|
|
406
|
-
Object.keys(tags).forEach(function forTag(tag) {
|
|
407
|
-
const scheme = {
|
|
408
|
-
"description": tag + " - " + tags[tag].join(", "),
|
|
409
|
-
"type": "boolean",
|
|
410
|
-
"default": true
|
|
411
|
-
};
|
|
412
|
-
schema.properties[tag] = scheme;
|
|
413
|
-
});
|
|
414
|
-
|
|
415
|
-
// Write schema
|
|
416
|
-
const schemaFile = path.join(__dirname, "markdownlint-config-schema.json");
|
|
417
|
-
fs.writeFileSync(schemaFile, JSON.stringify(schema, null, " "));
|