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