markdownlint 0.20.2 → 0.21.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.
Files changed (64) hide show
  1. package/CONTRIBUTING.md +50 -47
  2. package/LICENSE +21 -21
  3. package/README.md +915 -871
  4. package/demo/markdownlint-browser.js +4693 -5400
  5. package/doc/CustomRules.md +315 -313
  6. package/doc/Rules.md +1868 -1795
  7. package/helpers/LICENSE +21 -21
  8. package/helpers/README.md +50 -50
  9. package/helpers/helpers.js +690 -671
  10. package/helpers/package.json +18 -18
  11. package/lib/cache.js +24 -24
  12. package/lib/markdownlint.d.ts +365 -352
  13. package/lib/markdownlint.js +1186 -1101
  14. package/lib/md001.js +22 -22
  15. package/lib/md002.js +22 -22
  16. package/lib/md003.js +42 -42
  17. package/lib/md004.js +43 -43
  18. package/lib/md005.js +69 -69
  19. package/lib/md006.js +34 -34
  20. package/lib/md007.js +47 -47
  21. package/lib/md009.js +77 -77
  22. package/lib/md010.js +38 -38
  23. package/lib/md011.js +42 -38
  24. package/lib/md012.js +32 -32
  25. package/lib/md013.js +99 -99
  26. package/lib/md014.js +53 -53
  27. package/lib/md018.js +34 -34
  28. package/lib/md019.js +39 -39
  29. package/lib/md020.js +62 -62
  30. package/lib/md021.js +60 -60
  31. package/lib/md022.js +56 -56
  32. package/lib/md023.js +38 -38
  33. package/lib/md024.js +38 -38
  34. package/lib/md025.js +32 -32
  35. package/lib/md026.js +40 -40
  36. package/lib/md027.js +56 -56
  37. package/lib/md028.js +38 -38
  38. package/lib/md029.js +66 -66
  39. package/lib/md030.js +50 -50
  40. package/lib/md031.js +40 -39
  41. package/lib/md032.js +50 -50
  42. package/lib/md033.js +45 -45
  43. package/lib/md034.js +61 -61
  44. package/lib/md035.js +21 -21
  45. package/lib/md036.js +56 -56
  46. package/lib/md037.js +150 -141
  47. package/lib/md038.js +68 -68
  48. package/lib/md039.js +64 -64
  49. package/lib/md040.js +18 -18
  50. package/lib/md041.js +31 -31
  51. package/lib/md042.js +42 -41
  52. package/lib/md043.js +45 -45
  53. package/lib/md044.js +94 -71
  54. package/lib/md045.js +18 -18
  55. package/lib/md046.js +32 -32
  56. package/lib/md047.js +28 -28
  57. package/lib/md048.js +29 -29
  58. package/lib/rules.js +60 -61
  59. package/package.json +74 -67
  60. package/schema/build-config-schema.js +409 -405
  61. package/schema/markdownlint-config-schema.json +7 -2
  62. package/style/all.json +5 -5
  63. package/style/cirosantilli.json +22 -22
  64. package/style/relaxed.json +13 -13
@@ -1,352 +1,365 @@
1
- export = markdownlint;
2
- /**
3
- * Lint specified Markdown files.
4
- *
5
- * @param {Options} options Configuration options.
6
- * @param {LintCallback} callback Callback (err, result) function.
7
- * @returns {void}
8
- */
9
- declare function markdownlint(options: Options, callback: LintCallback): void;
10
- declare namespace markdownlint {
11
- export { markdownlintSync as sync, readConfig, readConfigSync, RuleFunction, RuleParams, MarkdownItToken, RuleOnError, RuleOnErrorInfo, RuleOnErrorFixInfo, Rule, Options, Plugin, ToStringCallback, LintResults, LintError, FixInfo, LintCallback, Configuration, RuleConfiguration, ConfigurationParser, ReadConfigCallback };
12
- }
13
- /**
14
- * Configuration options.
15
- */
16
- type Options = {
17
- /**
18
- * Files to lint.
19
- */
20
- files?: string | string[];
21
- /**
22
- * Strings to lint.
23
- */
24
- strings?: {
25
- [x: string]: string;
26
- };
27
- /**
28
- * Configuration object.
29
- */
30
- config?: {
31
- [x: string]: any;
32
- };
33
- /**
34
- * Custom rules.
35
- */
36
- customRules?: Rule | Rule[];
37
- /**
38
- * Front matter pattern.
39
- */
40
- frontMatter?: RegExp;
41
- /**
42
- * True to catch exceptions.
43
- */
44
- handleRuleFailures?: boolean;
45
- /**
46
- * True to ignore HTML directives.
47
- */
48
- noInlineConfig?: boolean;
49
- /**
50
- * Results object version.
51
- */
52
- resultVersion?: number;
53
- /**
54
- * Additional plugins.
55
- */
56
- markdownItPlugins?: any[][];
57
- };
58
- /**
59
- * Called with the result of the lint operation.
60
- */
61
- type LintCallback = (err: Error, results?: {
62
- [x: string]: LintError[];
63
- }) => void;
64
- /**
65
- * Lint specified Markdown files synchronously.
66
- *
67
- * @param {Options} options Configuration options.
68
- * @returns {LintResults} Results object.
69
- */
70
- declare function markdownlintSync(options: Options): {
71
- [x: string]: LintError[];
72
- };
73
- /**
74
- * Read specified configuration file.
75
- *
76
- * @param {string} file Configuration file name.
77
- * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing
78
- * function(s).
79
- * @param {ReadConfigCallback} [callback] Callback (err, result) function.
80
- * @returns {void}
81
- */
82
- declare function readConfig(file: string, parsers: ConfigurationParser[] | ReadConfigCallback, callback?: ReadConfigCallback): void;
83
- /**
84
- * Read specified configuration file synchronously.
85
- *
86
- * @param {string} file Configuration file name.
87
- * @param {ConfigurationParser[]} [parsers] Parsing function(s).
88
- * @returns {Configuration} Configuration object.
89
- */
90
- declare function readConfigSync(file: string, parsers?: ConfigurationParser[]): {
91
- [x: string]: any;
92
- };
93
- /**
94
- * Function to implement rule logic.
95
- */
96
- type RuleFunction = (params: RuleParams, onError: RuleOnError) => void;
97
- /**
98
- * Rule parameters.
99
- */
100
- type RuleParams = {
101
- /**
102
- * File/string name.
103
- */
104
- name: string;
105
- /**
106
- * markdown-it token objects.
107
- */
108
- tokens: MarkdownItToken[];
109
- /**
110
- * File/string lines.
111
- */
112
- lines: string[];
113
- /**
114
- * Front matter lines.
115
- */
116
- frontMatterLines: string[];
117
- /**
118
- * Rule configuration.
119
- */
120
- config: any;
121
- };
122
- /**
123
- * Markdown-It token.
124
- */
125
- type MarkdownItToken = {
126
- /**
127
- * HTML attributes.
128
- */
129
- attrs: string[][];
130
- /**
131
- * Block-level token.
132
- */
133
- block: boolean;
134
- /**
135
- * Child nodes.
136
- */
137
- children: MarkdownItToken[];
138
- /**
139
- * Tag contents.
140
- */
141
- content: string;
142
- /**
143
- * Ignore element.
144
- */
145
- hidden: boolean;
146
- /**
147
- * Fence info.
148
- */
149
- info: string;
150
- /**
151
- * Nesting level.
152
- */
153
- level: number;
154
- /**
155
- * Beginning/ending line numbers.
156
- */
157
- map: number[];
158
- /**
159
- * Markup text.
160
- */
161
- markup: string;
162
- /**
163
- * Arbitrary data.
164
- */
165
- meta: any;
166
- /**
167
- * Level change.
168
- */
169
- nesting: number;
170
- /**
171
- * HTML tag name.
172
- */
173
- tag: string;
174
- /**
175
- * Token type.
176
- */
177
- type: string;
178
- /**
179
- * Line number (1-based).
180
- */
181
- lineNumber: number;
182
- /**
183
- * Line content.
184
- */
185
- line: string;
186
- };
187
- /**
188
- * Error-reporting callback.
189
- */
190
- type RuleOnError = (onErrorInfo: RuleOnErrorInfo) => void;
191
- /**
192
- * Fix information for RuleOnError callback.
193
- */
194
- type RuleOnErrorInfo = {
195
- /**
196
- * Line number (1-based).
197
- */
198
- lineNumber: number;
199
- /**
200
- * Details about the error.
201
- */
202
- details?: string;
203
- /**
204
- * Context for the error.
205
- */
206
- context?: string;
207
- /**
208
- * Column number (1-based) and length.
209
- */
210
- range?: number[];
211
- /**
212
- * Fix information.
213
- */
214
- fixInfo?: RuleOnErrorFixInfo;
215
- };
216
- /**
217
- * Fix information for RuleOnErrorInfo.
218
- */
219
- type RuleOnErrorFixInfo = {
220
- /**
221
- * Line number (1-based).
222
- */
223
- lineNumber?: number;
224
- /**
225
- * Column of the fix (1-based).
226
- */
227
- editColumn?: number;
228
- /**
229
- * Count of characters to delete.
230
- */
231
- deleteCount?: number;
232
- /**
233
- * Text to insert (after deleting).
234
- */
235
- insertText?: string;
236
- };
237
- /**
238
- * Rule definition.
239
- */
240
- type Rule = {
241
- /**
242
- * Rule name(s).
243
- */
244
- names: string[];
245
- /**
246
- * Rule description.
247
- */
248
- description: string;
249
- /**
250
- * Link to more information.
251
- */
252
- information?: URL;
253
- /**
254
- * Rule tag(s).
255
- */
256
- tags: string[];
257
- /**
258
- * Rule implementation.
259
- */
260
- function: RuleFunction;
261
- };
262
- /**
263
- * markdown-it plugin.
264
- */
265
- type Plugin = any[];
266
- /**
267
- * Function to pretty-print lint results.
268
- */
269
- type ToStringCallback = (ruleAliases?: boolean) => string;
270
- /**
271
- * Lint results (for resultVersion 3).
272
- */
273
- type LintResults = {
274
- [x: string]: LintError[];
275
- };
276
- /**
277
- * Lint error.
278
- */
279
- type LintError = {
280
- /**
281
- * Line number (1-based).
282
- */
283
- lineNumber: number;
284
- /**
285
- * Rule name(s).
286
- */
287
- ruleNames: string[];
288
- /**
289
- * Rule description.
290
- */
291
- ruleDescription: string;
292
- /**
293
- * Link to more information.
294
- */
295
- ruleInformation: string;
296
- /**
297
- * Detail about the error.
298
- */
299
- errorDetail: string;
300
- /**
301
- * Context for the error.
302
- */
303
- errorContext: string;
304
- /**
305
- * Column number (1-based) and length.
306
- */
307
- errorRange: number[];
308
- /**
309
- * Fix information.
310
- */
311
- fixInfo: FixInfo;
312
- };
313
- /**
314
- * Fix information.
315
- */
316
- type FixInfo = {
317
- /**
318
- * Column of the fix (1-based).
319
- */
320
- editColumn?: number;
321
- /**
322
- * Count of characters to delete.
323
- */
324
- deleteCount?: number;
325
- /**
326
- * Text to insert (after deleting).
327
- */
328
- insertText?: string;
329
- };
330
- /**
331
- * Configuration object for linting rules. For a detailed schema, see
332
- * {@link ../schema/markdownlint-config-schema.json}.
333
- */
334
- type Configuration = {
335
- [x: string]: any;
336
- };
337
- /**
338
- * Rule configuration.
339
- */
340
- type RuleConfiguration = any;
341
- /**
342
- * Parses a configuration string and returns a configuration object.
343
- */
344
- type ConfigurationParser = (text: string) => {
345
- [x: string]: any;
346
- };
347
- /**
348
- * Called with the result of the readConfig operation.
349
- */
350
- type ReadConfigCallback = (err: Error, config?: {
351
- [x: string]: any;
352
- }) => void;
1
+ export = markdownlint;
2
+ /**
3
+ * Lint specified Markdown files.
4
+ *
5
+ * @param {Options} options Configuration options.
6
+ * @param {LintCallback} callback Callback (err, result) function.
7
+ * @returns {void}
8
+ */
9
+ declare function markdownlint(options: Options, callback: LintCallback): void;
10
+ declare namespace markdownlint {
11
+ export { markdownlintSync as sync, readConfig, readConfigSync, getVersion, promises, RuleFunction, RuleParams, MarkdownItToken, RuleOnError, RuleOnErrorInfo, RuleOnErrorFixInfo, Rule, Options, Plugin, ToStringCallback, LintResults, LintError, FixInfo, LintCallback, Configuration, RuleConfiguration, ConfigurationParser, ReadConfigCallback };
12
+ }
13
+ /**
14
+ * Configuration options.
15
+ */
16
+ type Options = {
17
+ /**
18
+ * Files to lint.
19
+ */
20
+ files?: string[] | string;
21
+ /**
22
+ * Strings to lint.
23
+ */
24
+ strings?: {
25
+ [x: string]: string;
26
+ };
27
+ /**
28
+ * Configuration object.
29
+ */
30
+ config?: Configuration;
31
+ /**
32
+ * Custom rules.
33
+ */
34
+ customRules?: Rule[] | Rule;
35
+ /**
36
+ * Front matter pattern.
37
+ */
38
+ frontMatter?: RegExp;
39
+ /**
40
+ * True to catch exceptions.
41
+ */
42
+ handleRuleFailures?: boolean;
43
+ /**
44
+ * True to ignore HTML directives.
45
+ */
46
+ noInlineConfig?: boolean;
47
+ /**
48
+ * Results object version.
49
+ */
50
+ resultVersion?: number;
51
+ /**
52
+ * Additional plugins.
53
+ */
54
+ markdownItPlugins?: any[][];
55
+ };
56
+ /**
57
+ * Called with the result of the lint operation.
58
+ */
59
+ type LintCallback = (err: Error | null, results?: LintResults) => void;
60
+ /**
61
+ * Lint specified Markdown files synchronously.
62
+ *
63
+ * @param {Options} options Configuration options.
64
+ * @returns {LintResults} Results object.
65
+ */
66
+ declare function markdownlintSync(options: Options): LintResults;
67
+ /**
68
+ * Read specified configuration file.
69
+ *
70
+ * @param {string} file Configuration file name.
71
+ * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing
72
+ * function(s).
73
+ * @param {ReadConfigCallback} [callback] Callback (err, result) function.
74
+ * @returns {void}
75
+ */
76
+ declare function readConfig(file: string, parsers: ConfigurationParser[] | ReadConfigCallback, callback?: ReadConfigCallback): void;
77
+ /**
78
+ * Read specified configuration file synchronously.
79
+ *
80
+ * @param {string} file Configuration file name.
81
+ * @param {ConfigurationParser[]} [parsers] Parsing function(s).
82
+ * @returns {Configuration} Configuration object.
83
+ */
84
+ declare function readConfigSync(file: string, parsers?: ConfigurationParser[]): Configuration;
85
+ /**
86
+ * Gets the (semantic) version of the library.
87
+ *
88
+ * @returns {string} SemVer string.
89
+ */
90
+ declare function getVersion(): string;
91
+ declare namespace promises {
92
+ export { markdownlintPromise as markdownlint };
93
+ export { readConfigPromise as readConfig };
94
+ }
95
+ /**
96
+ * Function to implement rule logic.
97
+ */
98
+ type RuleFunction = (params: RuleParams, onError: RuleOnError) => void;
99
+ /**
100
+ * Rule parameters.
101
+ */
102
+ type RuleParams = {
103
+ /**
104
+ * File/string name.
105
+ */
106
+ name: string;
107
+ /**
108
+ * markdown-it token objects.
109
+ */
110
+ tokens: MarkdownItToken[];
111
+ /**
112
+ * File/string lines.
113
+ */
114
+ lines: string[];
115
+ /**
116
+ * Front matter lines.
117
+ */
118
+ frontMatterLines: string[];
119
+ /**
120
+ * Rule configuration.
121
+ */
122
+ config: RuleConfiguration;
123
+ };
124
+ /**
125
+ * Markdown-It token.
126
+ */
127
+ type MarkdownItToken = {
128
+ /**
129
+ * HTML attributes.
130
+ */
131
+ attrs: string[][];
132
+ /**
133
+ * Block-level token.
134
+ */
135
+ block: boolean;
136
+ /**
137
+ * Child nodes.
138
+ */
139
+ children: MarkdownItToken[];
140
+ /**
141
+ * Tag contents.
142
+ */
143
+ content: string;
144
+ /**
145
+ * Ignore element.
146
+ */
147
+ hidden: boolean;
148
+ /**
149
+ * Fence info.
150
+ */
151
+ info: string;
152
+ /**
153
+ * Nesting level.
154
+ */
155
+ level: number;
156
+ /**
157
+ * Beginning/ending line numbers.
158
+ */
159
+ map: number[];
160
+ /**
161
+ * Markup text.
162
+ */
163
+ markup: string;
164
+ /**
165
+ * Arbitrary data.
166
+ */
167
+ meta: any;
168
+ /**
169
+ * Level change.
170
+ */
171
+ nesting: number;
172
+ /**
173
+ * HTML tag name.
174
+ */
175
+ tag: string;
176
+ /**
177
+ * Token type.
178
+ */
179
+ type: string;
180
+ /**
181
+ * Line number (1-based).
182
+ */
183
+ lineNumber: number;
184
+ /**
185
+ * Line content.
186
+ */
187
+ line: string;
188
+ };
189
+ /**
190
+ * Error-reporting callback.
191
+ */
192
+ type RuleOnError = (onErrorInfo: RuleOnErrorInfo) => void;
193
+ /**
194
+ * Fix information for RuleOnError callback.
195
+ */
196
+ type RuleOnErrorInfo = {
197
+ /**
198
+ * Line number (1-based).
199
+ */
200
+ lineNumber: number;
201
+ /**
202
+ * Details about the error.
203
+ */
204
+ details?: string;
205
+ /**
206
+ * Context for the error.
207
+ */
208
+ context?: string;
209
+ /**
210
+ * Column number (1-based) and length.
211
+ */
212
+ range?: number[];
213
+ /**
214
+ * Fix information.
215
+ */
216
+ fixInfo?: RuleOnErrorFixInfo;
217
+ };
218
+ /**
219
+ * Fix information for RuleOnErrorInfo.
220
+ */
221
+ type RuleOnErrorFixInfo = {
222
+ /**
223
+ * Line number (1-based).
224
+ */
225
+ lineNumber?: number;
226
+ /**
227
+ * Column of the fix (1-based).
228
+ */
229
+ editColumn?: number;
230
+ /**
231
+ * Count of characters to delete.
232
+ */
233
+ deleteCount?: number;
234
+ /**
235
+ * Text to insert (after deleting).
236
+ */
237
+ insertText?: string;
238
+ };
239
+ /**
240
+ * Rule definition.
241
+ */
242
+ type Rule = {
243
+ /**
244
+ * Rule name(s).
245
+ */
246
+ names: string[];
247
+ /**
248
+ * Rule description.
249
+ */
250
+ description: string;
251
+ /**
252
+ * Link to more information.
253
+ */
254
+ information?: URL;
255
+ /**
256
+ * Rule tag(s).
257
+ */
258
+ tags: string[];
259
+ /**
260
+ * Rule implementation.
261
+ */
262
+ function: RuleFunction;
263
+ };
264
+ /**
265
+ * markdown-it plugin.
266
+ */
267
+ type Plugin = any[];
268
+ /**
269
+ * Function to pretty-print lint results.
270
+ */
271
+ type ToStringCallback = (ruleAliases?: boolean) => string;
272
+ /**
273
+ * Lint results (for resultVersion 3).
274
+ */
275
+ type LintResults = {
276
+ [x: string]: LintError[];
277
+ };
278
+ /**
279
+ * Lint error.
280
+ */
281
+ type LintError = {
282
+ /**
283
+ * Line number (1-based).
284
+ */
285
+ lineNumber: number;
286
+ /**
287
+ * Rule name(s).
288
+ */
289
+ ruleNames: string[];
290
+ /**
291
+ * Rule description.
292
+ */
293
+ ruleDescription: string;
294
+ /**
295
+ * Link to more information.
296
+ */
297
+ ruleInformation: string;
298
+ /**
299
+ * Detail about the error.
300
+ */
301
+ errorDetail: string;
302
+ /**
303
+ * Context for the error.
304
+ */
305
+ errorContext: string;
306
+ /**
307
+ * Column number (1-based) and length.
308
+ */
309
+ errorRange: number[];
310
+ /**
311
+ * Fix information.
312
+ */
313
+ fixInfo: FixInfo;
314
+ };
315
+ /**
316
+ * Fix information.
317
+ */
318
+ type FixInfo = {
319
+ /**
320
+ * Column of the fix (1-based).
321
+ */
322
+ editColumn?: number;
323
+ /**
324
+ * Count of characters to delete.
325
+ */
326
+ deleteCount?: number;
327
+ /**
328
+ * Text to insert (after deleting).
329
+ */
330
+ insertText?: string;
331
+ };
332
+ /**
333
+ * Configuration object for linting rules. For a detailed schema, see
334
+ * {@link ../schema/markdownlint-config-schema.json}.
335
+ */
336
+ type Configuration = {
337
+ [x: string]: any;
338
+ };
339
+ /**
340
+ * Rule configuration.
341
+ */
342
+ type RuleConfiguration = any;
343
+ /**
344
+ * Parses a configuration string and returns a configuration object.
345
+ */
346
+ type ConfigurationParser = (text: string) => Configuration;
347
+ /**
348
+ * Called with the result of the readConfig operation.
349
+ */
350
+ type ReadConfigCallback = (err: Error | null, config?: Configuration) => void;
351
+ /**
352
+ * Lint specified Markdown files.
353
+ *
354
+ * @param {Options} options Configuration options.
355
+ * @returns {Promise<LintResults>} Results object.
356
+ */
357
+ declare function markdownlintPromise(options: Options): Promise<LintResults>;
358
+ /**
359
+ * Read specified configuration file.
360
+ *
361
+ * @param {string} file Configuration file name.
362
+ * @param {ConfigurationParser[]} [parsers] Parsing function(s).
363
+ * @returns {Promise<Configuration>} Configuration object.
364
+ */
365
+ declare function readConfigPromise(file: string, parsers?: ConfigurationParser[]): Promise<Configuration>;