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
package/lib/md009.js CHANGED
@@ -1,77 +1,77 @@
1
- // @ts-check
2
-
3
- "use strict";
4
-
5
- const { addError, filterTokens, forEachInlineCodeSpan, forEachLine,
6
- includesSorted, newLineRe, numericSortAscending } = require("../helpers");
7
- const { lineMetadata } = require("./cache");
8
-
9
- module.exports = {
10
- "names": [ "MD009", "no-trailing-spaces" ],
11
- "description": "Trailing spaces",
12
- "tags": [ "whitespace" ],
13
- "function": function MD009(params, onError) {
14
- let brSpaces = params.config.br_spaces;
15
- brSpaces = Number((brSpaces === undefined) ? 2 : brSpaces);
16
- const listItemEmptyLines = !!params.config.list_item_empty_lines;
17
- const strict = !!params.config.strict;
18
- const listItemLineNumbers = [];
19
- if (listItemEmptyLines) {
20
- filterTokens(params, "list_item_open", (token) => {
21
- for (let i = token.map[0]; i < token.map[1]; i++) {
22
- listItemLineNumbers.push(i + 1);
23
- }
24
- });
25
- listItemLineNumbers.sort(numericSortAscending);
26
- }
27
- const paragraphLineNumbers = [];
28
- const codeInlineLineNumbers = [];
29
- if (strict) {
30
- filterTokens(params, "paragraph_open", (token) => {
31
- for (let i = token.map[0]; i < token.map[1] - 1; i++) {
32
- paragraphLineNumbers.push(i + 1);
33
- }
34
- });
35
- paragraphLineNumbers.sort(numericSortAscending);
36
- filterTokens(params, "inline", (token) => {
37
- if (token.children.some((child) => child.type === "code_inline")) {
38
- const tokenLines = params.lines.slice(token.map[0], token.map[1]);
39
- forEachInlineCodeSpan(tokenLines.join("\n"), (code, lineIndex) => {
40
- const codeLineCount = code.split(newLineRe).length;
41
- for (let i = 0; i < codeLineCount; i++) {
42
- codeInlineLineNumbers.push(token.lineNumber + lineIndex + i);
43
- }
44
- });
45
- }
46
- });
47
- codeInlineLineNumbers.sort(numericSortAscending);
48
- }
49
- const expected = (brSpaces < 2) ? 0 : brSpaces;
50
- let inFencedCode = 0;
51
- forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence) => {
52
- inFencedCode += onFence;
53
- const lineNumber = lineIndex + 1;
54
- const trailingSpaces = line.length - line.trimRight().length;
55
- if ((!inCode || inFencedCode) && trailingSpaces &&
56
- !includesSorted(listItemLineNumbers, lineNumber)) {
57
- if ((expected !== trailingSpaces) ||
58
- (strict &&
59
- (!includesSorted(paragraphLineNumbers, lineNumber) ||
60
- includesSorted(codeInlineLineNumbers, lineNumber)))) {
61
- const column = line.length - trailingSpaces + 1;
62
- addError(
63
- onError,
64
- lineNumber,
65
- "Expected: " + (expected === 0 ? "" : "0 or ") +
66
- expected + "; Actual: " + trailingSpaces,
67
- null,
68
- [ column, trailingSpaces ],
69
- {
70
- "editColumn": column,
71
- "deleteCount": trailingSpaces
72
- });
73
- }
74
- }
75
- });
76
- }
77
- };
1
+ // @ts-check
2
+
3
+ "use strict";
4
+
5
+ const { addError, filterTokens, forEachInlineCodeSpan, forEachLine,
6
+ includesSorted, newLineRe, numericSortAscending } = require("../helpers");
7
+ const { lineMetadata } = require("./cache");
8
+
9
+ module.exports = {
10
+ "names": [ "MD009", "no-trailing-spaces" ],
11
+ "description": "Trailing spaces",
12
+ "tags": [ "whitespace" ],
13
+ "function": function MD009(params, onError) {
14
+ let brSpaces = params.config.br_spaces;
15
+ brSpaces = Number((brSpaces === undefined) ? 2 : brSpaces);
16
+ const listItemEmptyLines = !!params.config.list_item_empty_lines;
17
+ const strict = !!params.config.strict;
18
+ const listItemLineNumbers = [];
19
+ if (listItemEmptyLines) {
20
+ filterTokens(params, "list_item_open", (token) => {
21
+ for (let i = token.map[0]; i < token.map[1]; i++) {
22
+ listItemLineNumbers.push(i + 1);
23
+ }
24
+ });
25
+ listItemLineNumbers.sort(numericSortAscending);
26
+ }
27
+ const paragraphLineNumbers = [];
28
+ const codeInlineLineNumbers = [];
29
+ if (strict) {
30
+ filterTokens(params, "paragraph_open", (token) => {
31
+ for (let i = token.map[0]; i < token.map[1] - 1; i++) {
32
+ paragraphLineNumbers.push(i + 1);
33
+ }
34
+ });
35
+ paragraphLineNumbers.sort(numericSortAscending);
36
+ filterTokens(params, "inline", (token) => {
37
+ if (token.children.some((child) => child.type === "code_inline")) {
38
+ const tokenLines = params.lines.slice(token.map[0], token.map[1]);
39
+ forEachInlineCodeSpan(tokenLines.join("\n"), (code, lineIndex) => {
40
+ const codeLineCount = code.split(newLineRe).length;
41
+ for (let i = 0; i < codeLineCount; i++) {
42
+ codeInlineLineNumbers.push(token.lineNumber + lineIndex + i);
43
+ }
44
+ });
45
+ }
46
+ });
47
+ codeInlineLineNumbers.sort(numericSortAscending);
48
+ }
49
+ const expected = (brSpaces < 2) ? 0 : brSpaces;
50
+ let inFencedCode = 0;
51
+ forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence) => {
52
+ inFencedCode += onFence;
53
+ const lineNumber = lineIndex + 1;
54
+ const trailingSpaces = line.length - line.trimRight().length;
55
+ if ((!inCode || inFencedCode) && trailingSpaces &&
56
+ !includesSorted(listItemLineNumbers, lineNumber)) {
57
+ if ((expected !== trailingSpaces) ||
58
+ (strict &&
59
+ (!includesSorted(paragraphLineNumbers, lineNumber) ||
60
+ includesSorted(codeInlineLineNumbers, lineNumber)))) {
61
+ const column = line.length - trailingSpaces + 1;
62
+ addError(
63
+ onError,
64
+ lineNumber,
65
+ "Expected: " + (expected === 0 ? "" : "0 or ") +
66
+ expected + "; Actual: " + trailingSpaces,
67
+ null,
68
+ [ column, trailingSpaces ],
69
+ {
70
+ "editColumn": column,
71
+ "deleteCount": trailingSpaces
72
+ });
73
+ }
74
+ }
75
+ });
76
+ }
77
+ };
package/lib/md010.js CHANGED
@@ -1,38 +1,38 @@
1
- // @ts-check
2
-
3
- "use strict";
4
-
5
- const { addError, forEachLine } = require("../helpers");
6
- const { lineMetadata } = require("./cache");
7
-
8
- const tabRe = /\t+/g;
9
-
10
- module.exports = {
11
- "names": [ "MD010", "no-hard-tabs" ],
12
- "description": "Hard tabs",
13
- "tags": [ "whitespace", "hard_tab" ],
14
- "function": function MD010(params, onError) {
15
- const codeBlocks = params.config.code_blocks;
16
- const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
17
- forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
18
- if (!inCode || includeCodeBlocks) {
19
- let match = null;
20
- while ((match = tabRe.exec(line)) !== null) {
21
- const column = match.index + 1;
22
- const length = match[0].length;
23
- addError(
24
- onError,
25
- lineIndex + 1,
26
- "Column: " + column,
27
- null,
28
- [ column, length ],
29
- {
30
- "editColumn": column,
31
- "deleteCount": length,
32
- "insertText": "".padEnd(length)
33
- });
34
- }
35
- }
36
- });
37
- }
38
- };
1
+ // @ts-check
2
+
3
+ "use strict";
4
+
5
+ const { addError, forEachLine } = require("../helpers");
6
+ const { lineMetadata } = require("./cache");
7
+
8
+ const tabRe = /\t+/g;
9
+
10
+ module.exports = {
11
+ "names": [ "MD010", "no-hard-tabs" ],
12
+ "description": "Hard tabs",
13
+ "tags": [ "whitespace", "hard_tab" ],
14
+ "function": function MD010(params, onError) {
15
+ const codeBlocks = params.config.code_blocks;
16
+ const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
17
+ forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
18
+ if (!inCode || includeCodeBlocks) {
19
+ let match = null;
20
+ while ((match = tabRe.exec(line)) !== null) {
21
+ const column = match.index + 1;
22
+ const length = match[0].length;
23
+ addError(
24
+ onError,
25
+ lineIndex + 1,
26
+ "Column: " + column,
27
+ null,
28
+ [ column, length ],
29
+ {
30
+ "editColumn": column,
31
+ "deleteCount": length,
32
+ "insertText": "".padEnd(length)
33
+ });
34
+ }
35
+ }
36
+ });
37
+ }
38
+ };
package/lib/md011.js CHANGED
@@ -1,38 +1,42 @@
1
- // @ts-check
2
-
3
- "use strict";
4
-
5
- const { addError, forEachInlineChild, unescapeMarkdown } =
6
- require("../helpers");
7
-
8
- const reversedLinkRe = /\(([^)]+)\)\[([^\]^][^\]]*)]/g;
9
-
10
- module.exports = {
11
- "names": [ "MD011", "no-reversed-links" ],
12
- "description": "Reversed link syntax",
13
- "tags": [ "links" ],
14
- "function": function MD011(params, onError) {
15
- forEachInlineChild(params, "text", (token) => {
16
- const { lineNumber, content } = token;
17
- let match = null;
18
- while ((match = reversedLinkRe.exec(content)) !== null) {
19
- const [ reversedLink, linkText, linkDestination ] = match;
20
- const line = params.lines[lineNumber - 1];
21
- const column = unescapeMarkdown(line).indexOf(reversedLink) + 1;
22
- const length = reversedLink.length;
23
- addError(
24
- onError,
25
- lineNumber,
26
- reversedLink,
27
- null,
28
- [ column, length ],
29
- {
30
- "editColumn": column,
31
- "deleteCount": length,
32
- "insertText": `[${linkText}](${linkDestination})`
33
- }
34
- );
35
- }
36
- });
37
- }
38
- };
1
+ // @ts-check
2
+
3
+ "use strict";
4
+
5
+ const { addError, forEachInlineChild, unescapeMarkdown } =
6
+ require("../helpers");
7
+
8
+ const reversedLinkRe = /\(([^)]+)\)\[([^\]^][^\]]*)]/g;
9
+
10
+ module.exports = {
11
+ "names": [ "MD011", "no-reversed-links" ],
12
+ "description": "Reversed link syntax",
13
+ "tags": [ "links" ],
14
+ "function": function MD011(params, onError) {
15
+ forEachInlineChild(params, "text", (token) => {
16
+ const { lineNumber, content } = token;
17
+ let match = null;
18
+ while ((match = reversedLinkRe.exec(content)) !== null) {
19
+ const [ reversedLink, linkText, linkDestination ] = match;
20
+ const line = params.lines[lineNumber - 1];
21
+ const column = unescapeMarkdown(line).indexOf(reversedLink) + 1;
22
+ const length = reversedLink.length;
23
+ const range = column ? [ column, length ] : null;
24
+ const fixInfo = column ?
25
+ {
26
+ "editColumn": column,
27
+ "deleteCount": length,
28
+ "insertText": `[${linkText}](${linkDestination})`
29
+ } :
30
+ null;
31
+ addError(
32
+ onError,
33
+ lineNumber,
34
+ reversedLink,
35
+ null,
36
+ range,
37
+ fixInfo
38
+ );
39
+ }
40
+ });
41
+ }
42
+ };
package/lib/md012.js CHANGED
@@ -1,32 +1,32 @@
1
- // @ts-check
2
-
3
- "use strict";
4
-
5
- const { addErrorDetailIf, forEachLine } = require("../helpers");
6
- const { lineMetadata } = require("./cache");
7
-
8
- module.exports = {
9
- "names": [ "MD012", "no-multiple-blanks" ],
10
- "description": "Multiple consecutive blank lines",
11
- "tags": [ "whitespace", "blank_lines" ],
12
- "function": function MD012(params, onError) {
13
- const maximum = Number(params.config.maximum || 1);
14
- let count = 0;
15
- forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
16
- count = (inCode || line.trim().length) ? 0 : count + 1;
17
- if (maximum < count) {
18
- addErrorDetailIf(
19
- onError,
20
- lineIndex + 1,
21
- maximum,
22
- count,
23
- null,
24
- null,
25
- null,
26
- {
27
- "deleteCount": -1
28
- });
29
- }
30
- });
31
- }
32
- };
1
+ // @ts-check
2
+
3
+ "use strict";
4
+
5
+ const { addErrorDetailIf, forEachLine } = require("../helpers");
6
+ const { lineMetadata } = require("./cache");
7
+
8
+ module.exports = {
9
+ "names": [ "MD012", "no-multiple-blanks" ],
10
+ "description": "Multiple consecutive blank lines",
11
+ "tags": [ "whitespace", "blank_lines" ],
12
+ "function": function MD012(params, onError) {
13
+ const maximum = Number(params.config.maximum || 1);
14
+ let count = 0;
15
+ forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
16
+ count = (inCode || (line.trim().length > 0)) ? 0 : count + 1;
17
+ if (maximum < count) {
18
+ addErrorDetailIf(
19
+ onError,
20
+ lineIndex + 1,
21
+ maximum,
22
+ count,
23
+ null,
24
+ null,
25
+ null,
26
+ {
27
+ "deleteCount": -1
28
+ });
29
+ }
30
+ });
31
+ }
32
+ };
package/lib/md013.js CHANGED
@@ -1,99 +1,99 @@
1
- // @ts-check
2
-
3
- "use strict";
4
-
5
- const { addErrorDetailIf, filterTokens, forEachHeading, forEachLine,
6
- includesSorted } = require("../helpers");
7
- const { lineMetadata } = require("./cache");
8
-
9
- const longLineRePrefix = "^.{";
10
- const longLineRePostfixRelaxed = "}.*\\s.*$";
11
- const longLineRePostfixStrict = "}.+$";
12
- const labelRe = /^\s*\[.*[^\\]]:/;
13
- const linkOrImageOnlyLineRe = /^[es]*(lT?L|I)[ES]*$/;
14
- const sternModeRe = /^([#>\s]*\s)?\S*$/;
15
- const tokenTypeMap = {
16
- "em_open": "e",
17
- "em_close": "E",
18
- "image": "I",
19
- "link_open": "l",
20
- "link_close": "L",
21
- "strong_open": "s",
22
- "strong_close": "S",
23
- "text": "T"
24
- };
25
-
26
- module.exports = {
27
- "names": [ "MD013", "line-length" ],
28
- "description": "Line length",
29
- "tags": [ "line_length" ],
30
- "function": function MD013(params, onError) {
31
- const lineLength = Number(params.config.line_length || 80);
32
- const headingLineLength =
33
- Number(params.config.heading_line_length || lineLength);
34
- const codeLineLength =
35
- Number(params.config.code_block_line_length || lineLength);
36
- const strict = !!params.config.strict;
37
- const stern = !!params.config.stern;
38
- const longLineRePostfix =
39
- (strict || stern) ? longLineRePostfixStrict : longLineRePostfixRelaxed;
40
- const longLineRe =
41
- new RegExp(longLineRePrefix + lineLength + longLineRePostfix);
42
- const longHeadingLineRe =
43
- new RegExp(longLineRePrefix + headingLineLength + longLineRePostfix);
44
- const longCodeLineRe =
45
- new RegExp(longLineRePrefix + codeLineLength + longLineRePostfix);
46
- const codeBlocks = params.config.code_blocks;
47
- const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
48
- const tables = params.config.tables;
49
- const includeTables = (tables === undefined) ? true : !!tables;
50
- let headings = params.config.headings;
51
- if (headings === undefined) {
52
- headings = params.config.headers;
53
- }
54
- const includeHeadings = (headings === undefined) ? true : !!headings;
55
- const headingLineNumbers = [];
56
- forEachHeading(params, (heading) => {
57
- headingLineNumbers.push(heading.lineNumber);
58
- });
59
- const linkOnlyLineNumbers = [];
60
- filterTokens(params, "inline", (token) => {
61
- let childTokenTypes = "";
62
- token.children.forEach((child) => {
63
- if (child.type !== "text" || child.content !== "") {
64
- childTokenTypes += tokenTypeMap[child.type] || "x";
65
- }
66
- });
67
- if (linkOrImageOnlyLineRe.test(childTokenTypes)) {
68
- linkOnlyLineNumbers.push(token.lineNumber);
69
- }
70
- });
71
- forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence, inTable) => {
72
- const lineNumber = lineIndex + 1;
73
- const isHeading = includesSorted(headingLineNumbers, lineNumber);
74
- const length = inCode ?
75
- codeLineLength :
76
- (isHeading ? headingLineLength : lineLength);
77
- const lengthRe = inCode ?
78
- longCodeLineRe :
79
- (isHeading ? longHeadingLineRe : longLineRe);
80
- if ((includeCodeBlocks || !inCode) &&
81
- (includeTables || !inTable) &&
82
- (includeHeadings || !isHeading) &&
83
- (strict ||
84
- (!(stern && sternModeRe.test(line)) &&
85
- !includesSorted(linkOnlyLineNumbers, lineNumber) &&
86
- !labelRe.test(line))) &&
87
- lengthRe.test(line)) {
88
- addErrorDetailIf(
89
- onError,
90
- lineNumber,
91
- length,
92
- line.length,
93
- null,
94
- null,
95
- [ length + 1, line.length - length ]);
96
- }
97
- });
98
- }
99
- };
1
+ // @ts-check
2
+
3
+ "use strict";
4
+
5
+ const { addErrorDetailIf, filterTokens, forEachHeading, forEachLine,
6
+ includesSorted } = require("../helpers");
7
+ const { lineMetadata } = require("./cache");
8
+
9
+ const longLineRePrefix = "^.{";
10
+ const longLineRePostfixRelaxed = "}.*\\s.*$";
11
+ const longLineRePostfixStrict = "}.+$";
12
+ const labelRe = /^\s*\[.*[^\\]]:/;
13
+ const linkOrImageOnlyLineRe = /^[es]*(lT?L|I)[ES]*$/;
14
+ const sternModeRe = /^([#>\s]*\s)?\S*$/;
15
+ const tokenTypeMap = {
16
+ "em_open": "e",
17
+ "em_close": "E",
18
+ "image": "I",
19
+ "link_open": "l",
20
+ "link_close": "L",
21
+ "strong_open": "s",
22
+ "strong_close": "S",
23
+ "text": "T"
24
+ };
25
+
26
+ module.exports = {
27
+ "names": [ "MD013", "line-length" ],
28
+ "description": "Line length",
29
+ "tags": [ "line_length" ],
30
+ "function": function MD013(params, onError) {
31
+ const lineLength = Number(params.config.line_length || 80);
32
+ const headingLineLength =
33
+ Number(params.config.heading_line_length || lineLength);
34
+ const codeLineLength =
35
+ Number(params.config.code_block_line_length || lineLength);
36
+ const strict = !!params.config.strict;
37
+ const stern = !!params.config.stern;
38
+ const longLineRePostfix =
39
+ (strict || stern) ? longLineRePostfixStrict : longLineRePostfixRelaxed;
40
+ const longLineRe =
41
+ new RegExp(longLineRePrefix + lineLength + longLineRePostfix);
42
+ const longHeadingLineRe =
43
+ new RegExp(longLineRePrefix + headingLineLength + longLineRePostfix);
44
+ const longCodeLineRe =
45
+ new RegExp(longLineRePrefix + codeLineLength + longLineRePostfix);
46
+ const codeBlocks = params.config.code_blocks;
47
+ const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
48
+ const tables = params.config.tables;
49
+ const includeTables = (tables === undefined) ? true : !!tables;
50
+ let headings = params.config.headings;
51
+ if (headings === undefined) {
52
+ headings = params.config.headers;
53
+ }
54
+ const includeHeadings = (headings === undefined) ? true : !!headings;
55
+ const headingLineNumbers = [];
56
+ forEachHeading(params, (heading) => {
57
+ headingLineNumbers.push(heading.lineNumber);
58
+ });
59
+ const linkOnlyLineNumbers = [];
60
+ filterTokens(params, "inline", (token) => {
61
+ let childTokenTypes = "";
62
+ token.children.forEach((child) => {
63
+ if (child.type !== "text" || child.content !== "") {
64
+ childTokenTypes += tokenTypeMap[child.type] || "x";
65
+ }
66
+ });
67
+ if (linkOrImageOnlyLineRe.test(childTokenTypes)) {
68
+ linkOnlyLineNumbers.push(token.lineNumber);
69
+ }
70
+ });
71
+ forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence, inTable) => {
72
+ const lineNumber = lineIndex + 1;
73
+ const isHeading = includesSorted(headingLineNumbers, lineNumber);
74
+ const length = inCode ?
75
+ codeLineLength :
76
+ (isHeading ? headingLineLength : lineLength);
77
+ const lengthRe = inCode ?
78
+ longCodeLineRe :
79
+ (isHeading ? longHeadingLineRe : longLineRe);
80
+ if ((includeCodeBlocks || !inCode) &&
81
+ (includeTables || !inTable) &&
82
+ (includeHeadings || !isHeading) &&
83
+ (strict ||
84
+ (!(stern && sternModeRe.test(line)) &&
85
+ !includesSorted(linkOnlyLineNumbers, lineNumber) &&
86
+ !labelRe.test(line))) &&
87
+ lengthRe.test(line)) {
88
+ addErrorDetailIf(
89
+ onError,
90
+ lineNumber,
91
+ length,
92
+ line.length,
93
+ null,
94
+ null,
95
+ [ length + 1, line.length - length ]);
96
+ }
97
+ });
98
+ }
99
+ };