markdownlint 0.30.0 → 0.31.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/doc/Rules.md CHANGED
@@ -354,13 +354,11 @@ line with the start of the content of the parent list when a single space is
354
354
  used after the list marker. Indenting by 4 spaces is consistent with code blocks
355
355
  and simpler for editors to implement. Additionally, this can be a compatibility
356
356
  issue for other Markdown parsers, which require 4-space indents. More
357
- information: [Markdown Style Guide][markdown-style-guide] and [Marked app\
358
- support][marked-app-support].
357
+ information: [Markdown Style Guide][markdown-style-guide].
359
358
 
360
359
  Note: See [Prettier.md](Prettier.md) for compatibility information.
361
360
 
362
361
  [markdown-style-guide]: https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists
363
- [marked-app-support]: http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting
364
362
 
365
363
  <a name="md009"></a>
366
364
 
@@ -1349,31 +1347,48 @@ followed by a blank line:
1349
1347
 
1350
1348
  ```markdown
1351
1349
  Some text
1352
- * Some
1353
- * List
1350
+ * List item
1351
+ * List item
1354
1352
 
1355
- 1. Some
1356
- 2. List
1357
- Some text
1353
+ 1. List item
1354
+ 2. List item
1355
+ ***
1358
1356
  ```
1359
1357
 
1360
- To fix this, ensure that all lists have a blank line both before and after
1361
- (except where the block is at the beginning or end of the document):
1358
+ In the first case above, text immediately precedes the unordered list. In the
1359
+ second case above, a thematic break immediately follows the ordered list. To fix
1360
+ violations of this rule, ensure that all lists have a blank line both before and
1361
+ after (except when the list is at the very beginning or end of the document):
1362
1362
 
1363
1363
  ```markdown
1364
1364
  Some text
1365
1365
 
1366
- * Some
1367
- * List
1366
+ * List item
1367
+ * List item
1368
1368
 
1369
- 1. Some
1370
- 2. List
1369
+ 1. List item
1370
+ 2. List item
1371
1371
 
1372
- Some text
1372
+ ***
1373
1373
  ```
1374
1374
 
1375
- Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
1376
- not parse lists that don't have blank lines before and after them.
1375
+ Note that the following case is **not** a violation of this rule:
1376
+
1377
+ ```markdown
1378
+ 1. List item
1379
+ More item 1
1380
+ 2. List item
1381
+ More item 2
1382
+ ```
1383
+
1384
+ Although it is not indented, the text "More item 2" is referred to as a
1385
+ [lazy continuation line][lazy-continuation] and considered part of the second
1386
+ list item.
1387
+
1388
+ Rationale: In addition to aesthetic reasons, some parsers, including kramdown,
1389
+ will not parse lists that don't have blank lines before and after them.
1390
+
1391
+ [lazy-continuation]: https://spec.commonmark.org/0.30/#lazy-continuation-line
1377
1392
 
1378
1393
  <a name="md033"></a>
1379
1394
 
@@ -2216,6 +2231,10 @@ Tags: `images`, `links`
2216
2231
 
2217
2232
  Aliases: `reference-links-images`
2218
2233
 
2234
+ Parameters:
2235
+
2236
+ - `shortcut_syntax`: Include shortcut syntax (`boolean`, default `false`)
2237
+
2219
2238
  Links and images in Markdown can provide the link destination or image source
2220
2239
  at the time of use or can define it elsewhere and use a label for reference.
2221
2240
  The reference format is convenient for keeping paragraph text clutter-free
@@ -2236,13 +2255,16 @@ Shortcut: ![image]
2236
2255
  [image]: https://example.com/image
2237
2256
  ```
2238
2257
 
2239
- A link or image renders correctly when a corresponding label is defined, but
2240
- the text displays with brackets if the label is not present. This rule warns
2241
- of undefined labels for "full" and "collapsed" reference syntax.
2258
+ A link or image renders correctly when the corresponding label is defined, but
2259
+ displays as text with brackets when the label is not present. By default, this
2260
+ rule warns of undefined labels for "full" and "collapsed" reference syntax but
2261
+ not for "shortcut" syntax because it is ambiguous.
2242
2262
 
2243
- > "Shortcut" syntax is ambiguous and a missing label will not generate an
2244
- error. For example, `[shortcut]` could be a shortcut link or the text
2245
- "shortcut" in brackets.
2263
+ The text `[example]` could be a shortcut link or the text "example" in brackets,
2264
+ so "shortcut" syntax is ignored by default. To include "shortcut" syntax, set
2265
+ the `include_shortcut` parameter to `true`. Note that doing so produces warnings
2266
+ for *all* text in the document that *could* be a shortcut. If bracketed text is
2267
+ intentional, brackets can be escaped with the `\` character: `\[example\]`.
2246
2268
 
2247
2269
  <a name="md053"></a>
2248
2270
 
package/doc/md007.md CHANGED
@@ -46,10 +46,8 @@ line with the start of the content of the parent list when a single space is
46
46
  used after the list marker. Indenting by 4 spaces is consistent with code blocks
47
47
  and simpler for editors to implement. Additionally, this can be a compatibility
48
48
  issue for other Markdown parsers, which require 4-space indents. More
49
- information: [Markdown Style Guide][markdown-style-guide] and [Marked app\
50
- support][marked-app-support].
49
+ information: [Markdown Style Guide][markdown-style-guide].
51
50
 
52
51
  Note: See [Prettier.md](Prettier.md) for compatibility information.
53
52
 
54
53
  [markdown-style-guide]: https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists
55
- [marked-app-support]: http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting
package/doc/md032.md CHANGED
@@ -11,28 +11,45 @@ followed by a blank line:
11
11
 
12
12
  ```markdown
13
13
  Some text
14
- * Some
15
- * List
14
+ * List item
15
+ * List item
16
16
 
17
- 1. Some
18
- 2. List
19
- Some text
17
+ 1. List item
18
+ 2. List item
19
+ ***
20
20
  ```
21
21
 
22
- To fix this, ensure that all lists have a blank line both before and after
23
- (except where the block is at the beginning or end of the document):
22
+ In the first case above, text immediately precedes the unordered list. In the
23
+ second case above, a thematic break immediately follows the ordered list. To fix
24
+ violations of this rule, ensure that all lists have a blank line both before and
25
+ after (except when the list is at the very beginning or end of the document):
24
26
 
25
27
  ```markdown
26
28
  Some text
27
29
 
28
- * Some
29
- * List
30
+ * List item
31
+ * List item
30
32
 
31
- 1. Some
32
- 2. List
33
+ 1. List item
34
+ 2. List item
33
35
 
34
- Some text
36
+ ***
37
+ ```
38
+
39
+ Note that the following case is **not** a violation of this rule:
40
+
41
+ ```markdown
42
+ 1. List item
43
+ More item 1
44
+ 2. List item
45
+ More item 2
35
46
  ```
36
47
 
37
- Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will
38
- not parse lists that don't have blank lines before and after them.
48
+ Although it is not indented, the text "More item 2" is referred to as a
49
+ [lazy continuation line][lazy-continuation] and considered part of the second
50
+ list item.
51
+
52
+ Rationale: In addition to aesthetic reasons, some parsers, including kramdown,
53
+ will not parse lists that don't have blank lines before and after them.
54
+
55
+ [lazy-continuation]: https://spec.commonmark.org/0.30/#lazy-continuation-line
package/doc/md052.md CHANGED
@@ -4,6 +4,10 @@ Tags: `images`, `links`
4
4
 
5
5
  Aliases: `reference-links-images`
6
6
 
7
+ Parameters:
8
+
9
+ - `shortcut_syntax`: Include shortcut syntax (`boolean`, default `false`)
10
+
7
11
  Links and images in Markdown can provide the link destination or image source
8
12
  at the time of use or can define it elsewhere and use a label for reference.
9
13
  The reference format is convenient for keeping paragraph text clutter-free
@@ -24,10 +28,13 @@ Shortcut: ![image]
24
28
  [image]: https://example.com/image
25
29
  ```
26
30
 
27
- A link or image renders correctly when a corresponding label is defined, but
28
- the text displays with brackets if the label is not present. This rule warns
29
- of undefined labels for "full" and "collapsed" reference syntax.
31
+ A link or image renders correctly when the corresponding label is defined, but
32
+ displays as text with brackets when the label is not present. By default, this
33
+ rule warns of undefined labels for "full" and "collapsed" reference syntax but
34
+ not for "shortcut" syntax because it is ambiguous.
30
35
 
31
- > "Shortcut" syntax is ambiguous and a missing label will not generate an
32
- error. For example, `[shortcut]` could be a shortcut link or the text
33
- "shortcut" in brackets.
36
+ The text `[example]` could be a shortcut link or the text "example" in brackets,
37
+ so "shortcut" syntax is ignored by default. To include "shortcut" syntax, set
38
+ the `include_shortcut` parameter to `true`. Note that doing so produces warnings
39
+ for *all* text in the document that *could* be a shortcut. If bracketed text is
40
+ intentional, brackets can be escaped with the `\` character: `\[example\]`.
@@ -322,12 +322,18 @@ module.exports.unorderedListStyleFor = function unorderedListStyleFor(token) {
322
322
  }
323
323
  };
324
324
 
325
+ /**
326
+ * @callback TokenCallback
327
+ * @param {MarkdownItToken} token Current token.
328
+ * @returns {void}
329
+ */
330
+
325
331
  /**
326
332
  * Calls the provided function for each matching token.
327
333
  *
328
334
  * @param {Object} params RuleParams instance.
329
335
  * @param {string} type Token type identifier.
330
- * @param {Function} handler Callback function.
336
+ * @param {TokenCallback} handler Callback function.
331
337
  * @returns {void}
332
338
  */
333
339
  function filterTokens(params, type, handler) {
@@ -339,8 +345,17 @@ function filterTokens(params, type, handler) {
339
345
  }
340
346
  module.exports.filterTokens = filterTokens;
341
347
 
342
- // Get line metadata array
343
- module.exports.getLineMetadata = function getLineMetadata(params) {
348
+ /**
349
+ * @typedef {Array} LineMetadata
350
+ */
351
+
352
+ /**
353
+ * Gets a line metadata array.
354
+ *
355
+ * @param {Object} params RuleParams instance.
356
+ * @returns {LineMetadata} Line metadata.
357
+ */
358
+ function getLineMetadata(params) {
344
359
  const lineMetadata = params.lines.map(
345
360
  (line, index) => [ line, index, false, 0, false, false, false ]
346
361
  );
@@ -372,18 +387,32 @@ module.exports.getLineMetadata = function getLineMetadata(params) {
372
387
  lineMetadata[token.map[0]][6] = true;
373
388
  });
374
389
  return lineMetadata;
375
- };
390
+ }
391
+ module.exports.getLineMetadata = getLineMetadata;
392
+
393
+ /**
394
+ * @callback EachLineCallback
395
+ * @param {string} line Line content.
396
+ * @param {number} lineIndex Line index (0-based).
397
+ * @param {boolean} inCode Iff in a code block.
398
+ * @param {number} onFence + if open, - if closed, 0 otherwise.
399
+ * @param {boolean} inTable Iff in a table.
400
+ * @param {boolean} inItem Iff in a list item.
401
+ * @param {boolean} inBreak Iff in semantic break.
402
+ * @returns {void}
403
+ */
376
404
 
377
405
  /**
378
406
  * Calls the provided function for each line.
379
407
  *
380
- * @param {Object} lineMetadata Line metadata object.
381
- * @param {Function} handler Function taking (line, lineIndex, inCode, onFence,
382
- * inTable, inItem, inBreak).
408
+ * @param {LineMetadata} lineMetadata Line metadata object.
409
+ * @param {EachLineCallback} handler Function taking (line, lineIndex, inCode,
410
+ * onFence, inTable, inItem, inBreak).
383
411
  * @returns {void}
384
412
  */
385
413
  function forEachLine(lineMetadata, handler) {
386
414
  for (const metadata of lineMetadata) {
415
+ // @ts-ignore
387
416
  handler(...metadata);
388
417
  }
389
418
  }
@@ -454,12 +483,21 @@ module.exports.forEachHeading = function forEachHeading(params, handler) {
454
483
  }
455
484
  };
456
485
 
486
+ /**
487
+ * @callback InlineCodeSpanCallback
488
+ * @param {string} code Code content.
489
+ * @param {number} lineIndex Line index (0-based).
490
+ * @param {number} columnIndex Column index (0-based).
491
+ * @param {number} ticks Count of backticks.
492
+ * @returns {void}
493
+ */
494
+
457
495
  /**
458
496
  * Calls the provided function for each inline code span's content.
459
497
  *
460
498
  * @param {string} input Markdown content.
461
- * @param {Function} handler Callback function taking (code, lineIndex,
462
- * columnIndex, ticks).
499
+ * @param {InlineCodeSpanCallback} handler Callback function taking (code,
500
+ * lineIndex, columnIndex, ticks).
463
501
  * @returns {void}
464
502
  */
465
503
  function forEachInlineCodeSpan(input, handler) {
@@ -945,3 +983,23 @@ function expandTildePath(file, os) {
945
983
  return homedir ? file.replace(/^~($|\/|\\)/, `${homedir}$1`) : file;
946
984
  }
947
985
  module.exports.expandTildePath = expandTildePath;
986
+
987
+ // Copied from markdownlint.js to avoid TypeScript compiler import() issue.
988
+ /**
989
+ * @typedef {Object} MarkdownItToken
990
+ * @property {string[][]} attrs HTML attributes.
991
+ * @property {boolean} block Block-level token.
992
+ * @property {MarkdownItToken[]} children Child nodes.
993
+ * @property {string} content Tag contents.
994
+ * @property {boolean} hidden Ignore element.
995
+ * @property {string} info Fence info.
996
+ * @property {number} level Nesting level.
997
+ * @property {number[]} map Beginning/ending line numbers.
998
+ * @property {string} markup Markup text.
999
+ * @property {Object} meta Arbitrary data.
1000
+ * @property {number} nesting Level change.
1001
+ * @property {string} tag HTML tag name.
1002
+ * @property {string} type Token type.
1003
+ * @property {number} lineNumber Line number (1-based).
1004
+ * @property {string} line Line content.
1005
+ */
@@ -10,6 +10,8 @@ const {
10
10
  } = require("markdownlint-micromark");
11
11
  const { newLineRe } = require("./shared.js");
12
12
 
13
+ const flatTokensSymbol = Symbol("flat-tokens");
14
+
13
15
  /**
14
16
  * Markdown token.
15
17
  *
@@ -21,9 +23,32 @@ const { newLineRe } = require("./shared.js");
21
23
  * @property {number} endColumn End column (1-based).
22
24
  * @property {string} text Token text.
23
25
  * @property {Token[]} children Child tokens.
24
- * @property {Token[]} [htmlFlowChildren] Child tokens for htmlFlow.
25
26
  */
26
27
 
28
+ /**
29
+ * Returns whether a token is an htmlFlow type containing an HTML comment.
30
+ *
31
+ * @param {Token} token Micromark token.
32
+ * @returns {boolean} True iff token is htmlFlow containing a comment.
33
+ */
34
+ function isHtmlFlowComment(token) {
35
+ const { text, type } = token;
36
+ if (
37
+ (type === "htmlFlow") &&
38
+ text.startsWith("<!--") &&
39
+ text.endsWith("-->")
40
+ ) {
41
+ const comment = text.slice(4, -3);
42
+ return (
43
+ !comment.startsWith(">") &&
44
+ !comment.startsWith("->") &&
45
+ !comment.endsWith("-") &&
46
+ !comment.includes("--")
47
+ );
48
+ }
49
+ return false;
50
+ }
51
+
27
52
  /**
28
53
  * Parses a Markdown document and returns Micromark events.
29
54
  *
@@ -82,19 +107,21 @@ function micromarkParseWithOffset(
82
107
 
83
108
  // Create Token objects
84
109
  const document = [];
110
+ let flatTokens = [];
85
111
  let current = {
86
112
  "children": document
87
113
  };
88
114
  const history = [ current ];
89
115
  let reparseOptions = null;
90
116
  let lines = null;
117
+ let skipHtmlFlowChildren = false;
91
118
  for (const event of events) {
92
119
  const [ kind, token, context ] = event;
93
120
  const { type, start, end } = token;
94
121
  const { "column": startColumn, "line": startLine } = start;
95
122
  const { "column": endColumn, "line": endLine } = end;
96
123
  const text = context.sliceSerialize(token);
97
- if (kind === "enter") {
124
+ if ((kind === "enter") && !skipHtmlFlowChildren) {
98
125
  const previous = current;
99
126
  history.push(previous);
100
127
  current = {
@@ -106,7 +133,11 @@ function micromarkParseWithOffset(
106
133
  text,
107
134
  "children": []
108
135
  };
109
- if (current.type === "htmlFlow") {
136
+ previous.children.push(current);
137
+ flatTokens.push(current);
138
+ // @ts-ignore
139
+ if ((current.type === "htmlFlow") && !isHtmlFlowComment(current)) {
140
+ skipHtmlFlowChildren = true;
110
141
  if (!reparseOptions || !lines) {
111
142
  reparseOptions = {
112
143
  ...micromarkOptions,
@@ -123,23 +154,32 @@ function micromarkParseWithOffset(
123
154
  const reparseMarkdown = lines
124
155
  .slice(current.startLine - 1, current.endLine)
125
156
  .join("\n");
126
- current.htmlFlowChildren = micromarkParseWithOffset(
157
+ const tokens = micromarkParseWithOffset(
127
158
  reparseMarkdown,
128
159
  reparseOptions,
129
160
  referencesDefined,
130
161
  current.startLine - 1
131
162
  );
163
+ current.children = tokens;
164
+ // Avoid stack overflow of Array.push(...spread)
165
+ // eslint-disable-next-line unicorn/prefer-spread
166
+ flatTokens = flatTokens.concat(tokens[flatTokensSymbol]);
132
167
  }
133
- previous.children.push(current);
134
168
  } else if (kind === "exit") {
135
- Object.freeze(current.children);
136
- Object.freeze(current);
137
- // @ts-ignore
138
- current = history.pop();
169
+ if (type === "htmlFlow") {
170
+ skipHtmlFlowChildren = false;
171
+ }
172
+ if (!skipHtmlFlowChildren) {
173
+ Object.freeze(current.children);
174
+ Object.freeze(current);
175
+ // @ts-ignore
176
+ current = history.pop();
177
+ }
139
178
  }
140
179
  }
141
180
 
142
181
  // Return document
182
+ Object.defineProperty(document, flatTokensSymbol, { "value": flatTokens });
143
183
  Object.freeze(document);
144
184
  return document;
145
185
  }
@@ -166,83 +206,73 @@ function micromarkParse(
166
206
  }
167
207
 
168
208
  /**
169
- * Filter a list of Micromark tokens by predicate.
170
- *
171
- * @param {Token[]} tokens Micromark tokens.
172
- * @param {Function} allowed Allowed token predicate.
173
- * @param {Function} [transformChildren] Transform children predicate.
174
- * @returns {Token[]} Filtered tokens.
209
+ * @callback AllowedPredicate
210
+ * @param {Token} token Micromark token.
211
+ * @returns {boolean} True iff allowed.
175
212
  */
176
- function filterByPredicate(tokens, allowed, transformChildren) {
177
- const result = [];
178
- const pending = [ ...tokens ];
179
- let token = null;
180
- while ((token = pending.shift())) {
181
- if (allowed(token)) {
182
- result.push(token);
183
- }
184
- if (token.children.length > 0) {
185
- const transformed =
186
- transformChildren ? transformChildren(token) : token.children;
187
- pending.unshift(...transformed);
188
- }
189
- }
190
- return result;
191
- }
192
213
 
193
214
  /**
194
- * Filter a list of Micromark tokens by type.
195
- *
196
- * @param {Token[]} tokens Micromark tokens.
197
- * @param {string[]} allowed Types to allow.
198
- * @returns {Token[]} Filtered tokens.
215
+ * @callback TransformPredicate
216
+ * @param {Token} token Micromark token.
217
+ * @returns {Token[]} Child tokens.
199
218
  */
200
- function filterByTypes(tokens, allowed) {
201
- return filterByPredicate(
202
- tokens,
203
- (token) => allowed.includes(token.type)
204
- );
205
- }
206
219
 
207
220
  /**
208
- * Filter a list of Micromark tokens for HTML tokens.
221
+ * Filter a list of Micromark tokens by predicate.
209
222
  *
210
223
  * @param {Token[]} tokens Micromark tokens.
224
+ * @param {AllowedPredicate} allowed Allowed token predicate.
225
+ * @param {TransformPredicate} [transformChildren] Transform predicate.
211
226
  * @returns {Token[]} Filtered tokens.
212
227
  */
213
- function filterByHtmlTokens(tokens) {
228
+ function filterByPredicate(tokens, allowed, transformChildren) {
214
229
  const result = [];
215
- const pending = [ tokens ];
216
- let current = null;
217
- while ((current = pending.shift())) {
218
- for (const token of filterByTypes(current, [ "htmlFlow", "htmlText" ])) {
219
- if (token.type === "htmlText") {
230
+ const queue = [
231
+ {
232
+ "array": tokens,
233
+ "index": 0
234
+ }
235
+ ];
236
+ while (queue.length > 0) {
237
+ const current = queue[queue.length - 1];
238
+ const { array, index } = current;
239
+ if (index < array.length) {
240
+ const token = array[current.index++];
241
+ if (allowed(token)) {
220
242
  result.push(token);
221
- } else {
222
- // token.type === "htmlFlow"
223
- // @ts-ignore
224
- pending.push(token.htmlFlowChildren);
225
243
  }
244
+ const { children } = token;
245
+ if (children.length > 0) {
246
+ const transformed =
247
+ transformChildren ? transformChildren(token) : children;
248
+ queue.push(
249
+ {
250
+ "array": transformed,
251
+ "index": 0
252
+ }
253
+ );
254
+ }
255
+ } else {
256
+ queue.pop();
226
257
  }
227
258
  }
228
259
  return result;
229
260
  }
230
261
 
231
262
  /**
232
- * Returns a list of all nested child tokens.
263
+ * Filter a list of Micromark tokens by type.
233
264
  *
234
- * @param {Token} parent Micromark token.
235
- * @returns {Token[]} Flattened children.
265
+ * @param {Token[]} tokens Micromark tokens.
266
+ * @param {string[]} allowed Types to allow.
267
+ * @returns {Token[]} Filtered tokens.
236
268
  */
237
- function flattenedChildren(parent) {
238
- const result = [];
239
- const pending = [ ...parent.children ];
240
- let token = null;
241
- while ((token = pending.shift())) {
242
- result.push(token);
243
- pending.unshift(...token.children);
269
+ function filterByTypes(tokens, allowed) {
270
+ const predicate = (token) => allowed.includes(token.type);
271
+ const flatTokens = tokens[flatTokensSymbol];
272
+ if (flatTokens) {
273
+ return flatTokens.filter(predicate);
244
274
  }
245
- return result;
275
+ return filterByPredicate(tokens, predicate);
246
276
  }
247
277
 
248
278
  /**
@@ -338,10 +368,8 @@ function tokenIfType(token, type) {
338
368
 
339
369
  module.exports = {
340
370
  "parse": micromarkParse,
341
- filterByHtmlTokens,
342
371
  filterByPredicate,
343
372
  filterByTypes,
344
- flattenedChildren,
345
373
  getHeadingLevel,
346
374
  getHtmlTagInfo,
347
375
  getMicromarkEvents,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdownlint-rule-helpers",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "A collection of markdownlint helper functions for custom rules",
5
5
  "main": "./helpers.js",
6
6
  "exports": "./helpers.js",
@@ -9,7 +9,7 @@
9
9
  "homepage": "https://github.com/DavidAnson/markdownlint",
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/DavidAnson/markdownlint.git"
12
+ "url": "git+https://github.com/DavidAnson/markdownlint.git"
13
13
  },
14
14
  "bugs": "https://github.com/DavidAnson/markdownlint/issues",
15
15
  "engines": {
package/lib/constants.js CHANGED
@@ -11,4 +11,4 @@ module.exports.fixableRuleNames = [
11
11
  "MD044", "MD047", "MD049", "MD050", "MD051", "MD053"
12
12
  ];
13
13
  module.exports.homepage = "https://github.com/DavidAnson/markdownlint";
14
- module.exports.version = "0.30.0";
14
+ module.exports.version = "0.31.1";
@@ -8,7 +8,7 @@ export = markdownlint;
8
8
  */
9
9
  declare function markdownlint(options: Options | null, callback: LintCallback): void;
10
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, ResolveConfigExtendsCallback };
11
+ export { markdownlintSync as sync, readConfig, readConfigSync, getVersion, promises, RuleFunction, RuleParams, MarkdownItToken, RuleOnError, RuleOnErrorInfo, RuleOnErrorFixInfo, Rule, Options, Plugin, ToStringCallback, LintResults, LintError, FixInfo, LintContentCallback, LintCallback, Configuration, RuleConfiguration, ConfigurationParser, ReadConfigCallback, ResolveConfigExtendsCallback };
12
12
  }
13
13
  /**
14
14
  * Configuration options.
@@ -64,7 +64,7 @@ type Options = {
64
64
  /**
65
65
  * Called with the result of the lint function.
66
66
  */
67
- type LintCallback = (err: Error | null, results?: LintResults) => void;
67
+ type LintCallback = (error: Error | null, results?: LintResults) => void;
68
68
  /**
69
69
  * Lint specified Markdown files synchronously.
70
70
  *
@@ -353,6 +353,10 @@ type FixInfo = {
353
353
  */
354
354
  insertText?: string;
355
355
  };
356
+ /**
357
+ * Called with the result of linting a string or document.
358
+ */
359
+ type LintContentCallback = (error: Error | null, result?: LintError[]) => void;
356
360
  /**
357
361
  * Configuration object for linting rules. For a detailed schema, see
358
362
  * {@link ../schema/markdownlint-config-schema.json}.