markdownlint 0.27.0 → 0.28.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/lib/md034.js CHANGED
@@ -2,85 +2,67 @@
2
2
 
3
3
  "use strict";
4
4
 
5
- const { addErrorContext, filterTokens, funcExpExec, urlFe, withinAnyRange } =
6
- require("../helpers");
7
- const { codeBlockAndSpanRanges, htmlElementRanges, referenceLinkImageData } =
8
- require("./cache");
9
-
10
- const htmlLinkRe = /<a(?:\s[^>]*)?>[^<>]*<\/a\s*>/gi;
5
+ const { addErrorContext } = require("../helpers");
6
+ const { filterByPredicate, getHtmlTagInfo } =
7
+ require("../helpers/micromark.cjs");
11
8
 
12
9
  module.exports = {
13
10
  "names": [ "MD034", "no-bare-urls" ],
14
11
  "description": "Bare URL used",
15
12
  "tags": [ "links", "url" ],
16
13
  "function": function MD034(params, onError) {
17
- const { lines } = params;
18
- const codeExclusions = [
19
- ...codeBlockAndSpanRanges(),
20
- ...htmlElementRanges()
21
- ];
22
- filterTokens(params, "html_block", (token) => {
23
- for (let i = token.map[0]; i < token.map[1]; i++) {
24
- codeExclusions.push([ i, 0, lines[i].length ]);
25
- }
26
- });
27
- const { definitionLineIndices } = referenceLinkImageData();
28
- for (const [ lineIndex, line ] of lines.entries()) {
29
- if (definitionLineIndices[0] === lineIndex) {
30
- definitionLineIndices.shift();
31
- } else {
32
- let match = null;
33
- const lineExclusions = [];
34
- while ((match = htmlLinkRe.exec(line)) !== null) {
35
- lineExclusions.push([ lineIndex, match.index, match[0].length ]);
36
- }
37
- while ((match = funcExpExec(urlFe, line)) !== null) {
38
- const [ bareUrl ] = match;
39
- // @ts-ignore
40
- const matchIndex = match.index;
41
- const bareUrlLength = bareUrl.length;
42
- const prefix = line.slice(0, matchIndex);
43
- const postfix = line.slice(matchIndex + bareUrlLength);
44
- if (
45
- // Allow <...> to avoid reporting non-bare links
46
- !(prefix.endsWith("<") && postfix.startsWith(">")) &&
47
- // Allow >...</ to avoid reporting <code>...</code>
48
- !(prefix.endsWith(">") && postfix.startsWith("</")) &&
49
- // Allow "..." and '...' to allow quoting a bare link
50
- !(prefix.endsWith("\"") && postfix.startsWith("\"")) &&
51
- !(prefix.endsWith("'") && postfix.startsWith("'")) &&
52
- // Allow ](... to avoid reporting Markdown-style links
53
- !(/\]\(\s*$/.test(prefix)) &&
54
- // Allow [...] to avoid MD011/no-reversed-links and nested links
55
- !(/\[[^\]]*$/.test(prefix) && /^[^[]*\]/.test(postfix)) &&
56
- !withinAnyRange(
57
- lineExclusions, lineIndex, matchIndex, bareUrlLength
58
- ) &&
59
- !withinAnyRange(
60
- codeExclusions, lineIndex, matchIndex, bareUrlLength
61
- )
62
- ) {
63
- const range = [
64
- matchIndex + 1,
65
- bareUrlLength
66
- ];
67
- const fixInfo = {
68
- "editColumn": range[0],
69
- "deleteCount": range[1],
70
- "insertText": `<${bareUrl}>`
71
- };
72
- addErrorContext(
73
- onError,
74
- lineIndex + 1,
75
- bareUrl,
76
- null,
77
- null,
78
- range,
79
- fixInfo
80
- );
14
+ const literalAutolinks =
15
+ filterByPredicate(
16
+ params.parsers.micromark.tokens,
17
+ (token) => token.type === "literalAutolink",
18
+ (token) => {
19
+ const { children } = token;
20
+ const result = [];
21
+ for (let i = 0; i < children.length; i++) {
22
+ const openToken = children[i];
23
+ const openTagInfo = getHtmlTagInfo(openToken);
24
+ if (openTagInfo && !openTagInfo.close) {
25
+ let count = 1;
26
+ for (let j = i + 1; j < children.length; j++) {
27
+ const closeToken = children[j];
28
+ const closeTagInfo = getHtmlTagInfo(closeToken);
29
+ if (closeTagInfo && (openTagInfo.name === closeTagInfo.name)) {
30
+ if (closeTagInfo.close) {
31
+ count--;
32
+ if (count === 0) {
33
+ i = j;
34
+ break;
35
+ }
36
+ } else {
37
+ count++;
38
+ }
39
+ }
40
+ }
41
+ } else {
42
+ result.push(openToken);
43
+ }
81
44
  }
82
- }
83
- }
45
+ return result;
46
+ });
47
+ for (const token of literalAutolinks) {
48
+ const range = [
49
+ token.startColumn,
50
+ token.endColumn - token.startColumn
51
+ ];
52
+ const fixInfo = {
53
+ "editColumn": range[0],
54
+ "deleteCount": range[1],
55
+ "insertText": `<${token.text}>`
56
+ };
57
+ addErrorContext(
58
+ onError,
59
+ token.startLine,
60
+ token.text,
61
+ null,
62
+ null,
63
+ range,
64
+ fixInfo
65
+ );
84
66
  }
85
67
  }
86
68
  };
package/lib/md035.js CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  "use strict";
4
4
 
5
- const { addErrorDetailIf, filterTokens } = require("../helpers");
5
+ const { addErrorDetailIf } = require("../helpers");
6
+ const { filterByTypes } = require("../helpers/micromark.cjs");
6
7
 
7
8
  module.exports = {
8
9
  "names": [ "MD035", "hr-style" ],
@@ -10,17 +11,14 @@ module.exports = {
10
11
  "tags": [ "hr" ],
11
12
  "function": function MD035(params, onError) {
12
13
  let style = String(params.config.style || "consistent").trim();
13
- filterTokens(params, "hr", (token) => {
14
- const { line, lineNumber } = token;
15
- let { markup } = token;
16
- const match = line.match(/[_*\-\s]+$/);
17
- if (match) {
18
- markup = match[0].trim();
19
- }
14
+ const thematicBreaks =
15
+ filterByTypes(params.parsers.micromark.tokens, [ "thematicBreak" ]);
16
+ for (const token of thematicBreaks) {
17
+ const { startLine, text } = token;
20
18
  if (style === "consistent") {
21
- style = markup;
19
+ style = text;
22
20
  }
23
- addErrorDetailIf(onError, lineNumber, style, markup);
24
- });
21
+ addErrorDetailIf(onError, startLine, style, text);
22
+ }
25
23
  }
26
24
  };
package/lib/md036.js CHANGED
@@ -49,7 +49,7 @@ module.exports = {
49
49
  return base;
50
50
  }
51
51
  let state = base;
52
- for (const token of params.tokens) {
52
+ for (const token of params.parsers.markdownit.tokens) {
53
53
  state = state(token);
54
54
  }
55
55
  }
package/lib/md038.js CHANGED
@@ -2,70 +2,95 @@
2
2
 
3
3
  "use strict";
4
4
 
5
- const { addErrorContext, filterTokens, forEachInlineCodeSpan, newLineRe } =
6
- require("../helpers");
5
+ const { addErrorContext } = require("../helpers");
6
+ const { filterByTypes } = require("../helpers/micromark.cjs");
7
7
 
8
8
  const leftSpaceRe = /^\s(?:[^`]|$)/;
9
9
  const rightSpaceRe = /[^`]\s$/;
10
-
11
- const spaceInsideCodeInline = (token) => (
12
- (token.type === "code_inline") &&
13
- (leftSpaceRe.test(token.content) || rightSpaceRe.test(token.content))
14
- );
10
+ const trimCodeText = (text, start, end) => {
11
+ text = text.replace(/^\s+$/, "");
12
+ if (start) {
13
+ text = text.replace(/^\s+?(\s`|\S)/, "$1");
14
+ }
15
+ if (end) {
16
+ text = text.replace(/(`\s|\S)\s+$/, "$1");
17
+ }
18
+ return text;
19
+ };
20
+ const tokenIfType = (token, type) => token && (token.type === type) && token;
15
21
 
16
22
  module.exports = {
17
23
  "names": [ "MD038", "no-space-in-code" ],
18
24
  "description": "Spaces inside code span elements",
19
25
  "tags": [ "whitespace", "code" ],
20
26
  "function": function MD038(params, onError) {
21
- filterTokens(params, "inline", (token) => {
22
- if (token.children.some(spaceInsideCodeInline)) {
23
- const tokenLines = params.lines.slice(token.map[0], token.map[1]);
24
- forEachInlineCodeSpan(
25
- tokenLines.join("\n"),
26
- (code, lineIndex, columnIndex, tickCount) => {
27
- let rangeIndex = columnIndex - tickCount;
28
- let rangeLength = code.length + (2 * tickCount);
29
- let rangeLineOffset = 0;
30
- let fixIndex = columnIndex;
31
- let fixLength = code.length;
32
- const codeLines = code.split(newLineRe);
33
- const left = leftSpaceRe.test(code);
34
- const right = !left && rightSpaceRe.test(code);
35
- if (right && (codeLines.length > 1)) {
36
- rangeIndex = 0;
37
- rangeLineOffset = codeLines.length - 1;
38
- fixIndex = 0;
39
- }
40
- if (left || right) {
41
- const codeLinesRange = codeLines[rangeLineOffset];
42
- if (codeLines.length > 1) {
43
- rangeLength = codeLinesRange.length + tickCount;
44
- fixLength = codeLinesRange.length;
45
- }
46
- const context = tokenLines[lineIndex + rangeLineOffset]
47
- .substring(rangeIndex, rangeIndex + rangeLength);
48
- const codeLinesRangeTrim = codeLinesRange.trim();
49
- const fixText =
50
- (codeLinesRangeTrim.startsWith("`") ? " " : "") +
51
- codeLinesRangeTrim +
52
- (codeLinesRangeTrim.endsWith("`") ? " " : "");
53
- addErrorContext(
54
- onError,
55
- token.lineNumber + lineIndex + rangeLineOffset,
56
- context,
57
- left,
58
- right,
59
- [ rangeIndex + 1, rangeLength ],
60
- {
61
- "editColumn": fixIndex + 1,
62
- "deleteCount": fixLength,
63
- "insertText": fixText
64
- }
65
- );
66
- }
67
- });
27
+ const codeTextTokens =
28
+ filterByTypes(params.parsers.micromark.tokens, [ "codeText" ]);
29
+ for (const token of codeTextTokens) {
30
+ const { children } = token;
31
+ const first = 0;
32
+ const last = children.length - 1;
33
+ const startSequence = tokenIfType(children[first], "codeTextSequence");
34
+ const endSequence = tokenIfType(children[last], "codeTextSequence");
35
+ const startData =
36
+ tokenIfType(children[first + 1], "codeTextData") ||
37
+ tokenIfType(children[first + 2], "codeTextData");
38
+ const endData =
39
+ tokenIfType(children[last - 1], "codeTextData") ||
40
+ tokenIfType(children[last - 2], "codeTextData");
41
+ if (startSequence && endSequence && startData && endData) {
42
+ const spaceLeft = leftSpaceRe.test(startData.text);
43
+ const spaceRight = !spaceLeft && rightSpaceRe.test(endData.text);
44
+ if (spaceLeft || spaceRight) {
45
+ let lineNumber = startSequence.startLine;
46
+ let range = null;
47
+ let fixInfo = null;
48
+ if (startSequence.startLine === endSequence.endLine) {
49
+ range = [
50
+ startSequence.startColumn,
51
+ endSequence.endColumn - startSequence.startColumn
52
+ ];
53
+ fixInfo = {
54
+ "editColumn": startSequence.endColumn,
55
+ "deleteCount": endSequence.startColumn - startSequence.endColumn,
56
+ "insertText": trimCodeText(startData.text, true, true)
57
+ };
58
+ } else if (spaceLeft) {
59
+ range = [
60
+ startSequence.startColumn,
61
+ startData.endColumn - startSequence.startColumn
62
+ ];
63
+ fixInfo = {
64
+ "editColumn": startSequence.endColumn,
65
+ "deleteCount": startData.endColumn - startData.startColumn,
66
+ "insertText": trimCodeText(startData.text, true, false)
67
+ };
68
+ } else {
69
+ lineNumber = endSequence.endLine;
70
+ range = [
71
+ endData.startColumn,
72
+ endSequence.endColumn - endData.startColumn
73
+ ];
74
+ fixInfo = {
75
+ "editColumn": endData.startColumn,
76
+ "deleteCount": endData.endColumn - endData.startColumn,
77
+ "insertText": trimCodeText(endData.text, false, true)
78
+ };
79
+ }
80
+ const context = params
81
+ .lines[lineNumber - 1]
82
+ .substring(range[0] - 1, range[0] - 1 + range[1]);
83
+ addErrorContext(
84
+ onError,
85
+ lineNumber,
86
+ context,
87
+ spaceLeft,
88
+ spaceRight,
89
+ range,
90
+ fixInfo
91
+ );
92
+ }
68
93
  }
69
- });
94
+ }
70
95
  }
71
96
  };
package/lib/md041.js CHANGED
@@ -18,7 +18,7 @@ module.exports = {
18
18
  );
19
19
  if (!foundFrontMatterTitle) {
20
20
  const htmlHeadingRe = new RegExp(`^<h${level}[ />]`, "i");
21
- params.tokens.every((token) => {
21
+ params.parsers.markdownit.tokens.every((token) => {
22
22
  let isError = false;
23
23
  if (token.type === "html_block") {
24
24
  if (token.content.startsWith("<!--")) {
package/lib/md044.js CHANGED
@@ -2,11 +2,14 @@
2
2
 
3
3
  "use strict";
4
4
 
5
- const { addErrorDetailIf, escapeForRegExp, forEachLine, forEachLink,
6
- funcExpExec, linkReferenceDefinitionRe, urlFe, withinAnyRange } =
5
+ const { addErrorDetailIf, escapeForRegExp, withinAnyRange } =
7
6
  require("../helpers");
8
- const { codeBlockAndSpanRanges, htmlElementRanges, lineMetadata } =
9
- require("./cache");
7
+ const { filterByPredicate, filterByTypes, parse } =
8
+ require("../helpers/micromark.cjs");
9
+
10
+ const ignoredChildTypes = new Set(
11
+ [ "codeFencedFence", "definition", "reference", "resource" ]
12
+ );
10
13
 
11
14
  module.exports = {
12
15
  "names": [ "MD044", "proper-names" ],
@@ -22,31 +25,25 @@ module.exports = {
22
25
  const htmlElements = params.config.html_elements;
23
26
  const includeHtmlElements =
24
27
  (htmlElements === undefined) ? true : !!htmlElements;
25
- const exclusions = [];
26
- forEachLine(lineMetadata(), (line, lineIndex) => {
27
- if (linkReferenceDefinitionRe.test(line)) {
28
- exclusions.push([ lineIndex, 0, line.length ]);
29
- } else {
30
- let match = null;
31
- while ((match = funcExpExec(urlFe, line)) !== null) {
32
- // @ts-ignore
33
- exclusions.push([ lineIndex, match.index, match[0].length ]);
34
- }
35
- forEachLink(line, (index, _, text, destination) => {
36
- if (destination) {
37
- exclusions.push(
38
- [ lineIndex, index + text.length, destination.length ]
39
- );
40
- }
41
- });
42
- }
43
- });
44
- if (!includeCodeBlocks) {
45
- exclusions.push(...codeBlockAndSpanRanges());
46
- }
47
- if (!includeHtmlElements) {
48
- exclusions.push(...htmlElementRanges());
28
+ const scannedTypes = new Set([ "data", "htmlFlowData" ]);
29
+ if (includeCodeBlocks) {
30
+ scannedTypes.add("codeFlowValue");
31
+ scannedTypes.add("codeTextData");
49
32
  }
33
+ const contentTokens =
34
+ filterByPredicate(
35
+ params.parsers.micromark.tokens,
36
+ (token) => scannedTypes.has(token.type),
37
+ (token) => {
38
+ let { children } = token;
39
+ if (!includeHtmlElements && (token.type === "htmlFlow")) {
40
+ children = children.slice(1, -1);
41
+ }
42
+ return children.filter((t) => !ignoredChildTypes.has(t.type));
43
+ }
44
+ );
45
+ const exclusions = [];
46
+ const autoLinked = new Set();
50
47
  for (const name of names) {
51
48
  const escapedName = escapeForRegExp(name);
52
49
  const startNamePattern = /^\W/.test(name) ? "" : "\\b_*";
@@ -54,36 +51,53 @@ module.exports = {
54
51
  const namePattern =
55
52
  `(${startNamePattern})(${escapedName})${endNamePattern}`;
56
53
  const nameRe = new RegExp(namePattern, "gi");
57
- forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence) => {
58
- if (includeCodeBlocks || (!inCode && !onFence)) {
59
- let match = null;
60
- while ((match = nameRe.exec(line)) !== null) {
61
- const [ , leftMatch, nameMatch ] = match;
62
- const index = match.index + leftMatch.length;
63
- const length = nameMatch.length;
64
- if (
65
- !withinAnyRange(exclusions, lineIndex, index, length) &&
66
- !names.includes(nameMatch)
67
- ) {
54
+ for (const token of contentTokens) {
55
+ let match = null;
56
+ while ((match = nameRe.exec(token.text)) !== null) {
57
+ const [ , leftMatch, nameMatch ] = match;
58
+ const index = token.startColumn - 1 + match.index + leftMatch.length;
59
+ const length = nameMatch.length;
60
+ const lineIndex = token.startLine - 1;
61
+ if (
62
+ !withinAnyRange(exclusions, lineIndex, index, length) &&
63
+ !names.includes(nameMatch)
64
+ ) {
65
+ let urlRanges = [];
66
+ if (!autoLinked.has(token)) {
67
+ urlRanges = filterByTypes(
68
+ parse(token.text),
69
+ [ "literalAutolink" ]
70
+ ).map(
71
+ (t) => [
72
+ lineIndex,
73
+ token.startColumn - 1 + t.startColumn - 1,
74
+ t.endColumn - t.startColumn
75
+ ]
76
+ );
77
+ exclusions.push(...urlRanges);
78
+ autoLinked.add(token);
79
+ }
80
+ if (!withinAnyRange(urlRanges, lineIndex, index, length)) {
81
+ const column = index + 1;
68
82
  addErrorDetailIf(
69
83
  onError,
70
- lineIndex + 1,
84
+ token.startLine,
71
85
  name,
72
86
  nameMatch,
73
87
  null,
74
88
  null,
75
- [ index + 1, length ],
89
+ [ column, length ],
76
90
  {
77
- "editColumn": index + 1,
91
+ "editColumn": column,
78
92
  "deleteCount": length,
79
93
  "insertText": name
80
94
  }
81
95
  );
82
96
  }
83
- exclusions.push([ lineIndex, index, length ]);
84
97
  }
98
+ exclusions.push([ lineIndex, index, length ]);
85
99
  }
86
- });
100
+ }
87
101
  }
88
102
  }
89
103
  };
package/lib/md046.js CHANGED
@@ -15,7 +15,7 @@ module.exports = {
15
15
  "tags": [ "code" ],
16
16
  "function": function MD046(params, onError) {
17
17
  let expectedStyle = String(params.config.style || "consistent");
18
- const codeBlocksAndFences = params.tokens.filter(
18
+ const codeBlocksAndFences = params.parsers.markdownit.tokens.filter(
19
19
  (token) => (token.type === "code_block") || (token.type === "fence")
20
20
  );
21
21
  for (const token of codeBlocksAndFences) {
package/lib/md048.js CHANGED
@@ -11,7 +11,9 @@ module.exports = {
11
11
  "function": function MD048(params, onError) {
12
12
  const style = String(params.config.style || "consistent");
13
13
  let expectedStyle = style;
14
- const fenceTokens = params.tokens.filter((token) => token.type === "fence");
14
+ const fenceTokens = params.parsers.markdownit.tokens.filter(
15
+ (token) => token.type === "fence"
16
+ );
15
17
  for (const fenceToken of fenceTokens) {
16
18
  const { lineNumber, markup } = fenceToken;
17
19
  if (expectedStyle === "consistent") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdownlint",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "A Node.js style checker and lint tool for Markdown/CommonMark files.",
5
5
  "type": "commonjs",
6
6
  "main": "./lib/markdownlint.js",
@@ -25,70 +25,75 @@
25
25
  "build-config": "npm run build-config-schema && npm run build-config-example",
26
26
  "build-config-example": "node schema/build-config-example.js",
27
27
  "build-config-schema": "node schema/build-config-schema.js",
28
- "build-declaration": "tsc --allowJs --declaration --emitDeclarationOnly --module commonjs --resolveJsonModule --target es2015 lib/markdownlint.js && node scripts delete 'lib/{c,md,r}*.d.ts' 'helpers/*.d.ts'",
29
- "build-demo": "node scripts copy node_modules/markdown-it/dist/markdown-it.min.js demo/markdown-it.min.js && cd demo && webpack --no-stats",
28
+ "build-declaration": "tsc --allowJs --declaration --emitDeclarationOnly --module commonjs --resolveJsonModule --target es2015 lib/markdownlint.js && node scripts delete 'lib/{c,md,r}*.d.ts' 'micromark/*.d.cts' 'helpers/*.d.{cts,ts}'",
29
+ "build-demo": "node scripts copy node_modules/markdown-it/dist/markdown-it.min.js demo/markdown-it.min.js && node scripts copy node_modules/markdownlint-micromark/micromark-browser.js demo/micromark-browser.js && cd demo && webpack --no-stats",
30
30
  "build-docs": "node doc-build/build-rules.mjs",
31
31
  "build-example": "npm install --no-save --ignore-scripts grunt grunt-cli gulp through2",
32
+ "build-micromark": "cd micromark && npm run build",
32
33
  "ci": "npm-run-all --continue-on-error --parallel lint serial-config-docs serial-declaration-demo test-cover && git diff --exit-code",
33
34
  "clone-test-repos-apache-airflow": "cd test-repos && git clone https://github.com/apache/airflow apache-airflow --depth 1 --no-tags --quiet",
34
35
  "clone-test-repos-dotnet-docs": "cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet",
35
36
  "clone-test-repos-electron-electron": "cd test-repos && git clone https://github.com/electron/electron electron-electron --depth 1 --no-tags --quiet",
36
37
  "clone-test-repos-eslint-eslint": "cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet",
37
38
  "clone-test-repos-mdn-content": "cd test-repos && git clone https://github.com/mdn/content mdn-content --depth 1 --no-tags --quiet",
39
+ "clone-test-repos-mdn-translated-content": "cd test-repos && git clone https://github.com/mdn/translated-content mdn-translated-content --depth 1 --no-tags --quiet",
38
40
  "clone-test-repos-mkdocs-mkdocs": "cd test-repos && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet",
39
41
  "clone-test-repos-mochajs-mocha": "cd test-repos && git clone https://github.com/mochajs/mocha mochajs-mocha --depth 1 --no-tags --quiet",
40
42
  "clone-test-repos-pi-hole-docs": "cd test-repos && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet",
41
43
  "clone-test-repos-v8-v8-dev": "cd test-repos && git clone https://github.com/v8/v8.dev v8-v8-dev --depth 1 --no-tags --quiet",
42
44
  "clone-test-repos-webhintio-hint": "cd test-repos && git clone https://github.com/webhintio/hint webhintio-hint --depth 1 --no-tags --quiet",
43
45
  "clone-test-repos-webpack-webpack-js-org": "cd test-repos && git clone https://github.com/webpack/webpack.js.org webpack-webpack-js-org --depth 1 --no-tags --quiet",
44
- "clone-test-repos": "mkdir test-repos && cd test-repos && npm run clone-test-repos-apache-airflow && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-electron-electron && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mdn-content && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-v8-v8-dev && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org",
46
+ "clone-test-repos": "mkdir test-repos && cd test-repos && npm run clone-test-repos-apache-airflow && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-electron-electron && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mdn-content && npm run clone-test-repos-mdn-translated-content && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-v8-v8-dev && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org",
45
47
  "declaration": "npm run build-declaration && npm run test-declaration",
46
48
  "example": "cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint",
47
49
  "docker-npm-install": "docker run --rm --tty --name npm-install --volume $PWD:/home/workdir --workdir /home/workdir --user node node:16 npm install",
48
50
  "docker-npm-run-upgrade": "docker run --rm --tty --name npm-run-upgrade --volume $PWD:/home/workdir --workdir /home/workdir --user node node:16 npm run upgrade",
49
- "lint": "eslint --ext .js,.mjs --max-warnings 0 .",
50
- "lint-test-repos": "ava --timeout=5m test/markdownlint-test-repos.js",
51
+ "lint": "eslint --ext .js,.cjs,.mjs --max-warnings 0 .",
52
+ "lint-test-repos": "ava --timeout=10m test/markdownlint-test-repos.js",
51
53
  "serial-config-docs": "npm run build-config && npm run build-docs",
52
54
  "serial-declaration-demo": "npm run build-declaration && npm-run-all --continue-on-error --parallel build-demo test-declaration",
53
- "test": "ava test/markdownlint-test.js test/markdownlint-test-config.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js",
54
- "test-cover": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test",
55
+ "test": "ava test/markdownlint-test.js test/markdownlint-test-config.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-micromark.mjs test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js",
56
+ "test-cover": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --exclude 'test/**' --exclude 'micromark/**' npm test",
55
57
  "test-declaration": "cd example/typescript && tsc && node type-check.js",
56
58
  "test-extra": "ava --timeout=5m test/markdownlint-test-extra-parse.js test/markdownlint-test-extra-type.js",
57
- "update-snapshots": "ava --update-snapshots test/markdownlint-test-scenarios.js",
59
+ "update-snapshots": "ava --update-snapshots test/markdownlint-test-micromark.mjs test/markdownlint-test-scenarios.js",
58
60
  "upgrade": "npx --yes npm-check-updates --upgrade"
59
61
  },
60
62
  "engines": {
61
63
  "node": ">=14.18.0"
62
64
  },
63
65
  "dependencies": {
64
- "markdown-it": "13.0.1"
66
+ "markdown-it": "13.0.1",
67
+ "markdownlint-micromark": "0.1.2"
65
68
  },
66
69
  "devDependencies": {
67
- "ava": "5.1.0",
68
- "c8": "7.12.0",
69
- "eslint": "8.30.0",
70
+ "ava": "5.2.0",
71
+ "babel-loader": "9.1.2",
72
+ "@babel/core": "7.21.3",
73
+ "@babel/preset-env": "7.20.2",
74
+ "c8": "7.13.0",
75
+ "eslint": "8.36.0",
70
76
  "eslint-plugin-es": "4.1.0",
71
- "eslint-plugin-jsdoc": "39.6.4",
72
- "eslint-plugin-n": "15.6.0",
73
- "eslint-plugin-regexp": "1.11.0",
74
- "eslint-plugin-unicorn": "45.0.2",
77
+ "eslint-plugin-jsdoc": "40.1.0",
78
+ "eslint-plugin-n": "15.6.1",
79
+ "eslint-plugin-regexp": "1.13.0",
80
+ "eslint-plugin-unicorn": "46.0.0",
75
81
  "globby": "13.1.3",
76
82
  "js-yaml": "4.1.0",
77
- "markdown-it-footnote": "3.0.3",
78
83
  "markdown-it-for-inline": "0.1.1",
79
84
  "markdown-it-sub": "1.0.0",
80
85
  "markdown-it-sup": "1.0.0",
81
86
  "markdown-it-texmath": "1.0.0",
82
- "markdownlint-rule-helpers": "0.17.2",
87
+ "markdownlint-rule-helpers": "0.18.0",
83
88
  "npm-run-all": "4.1.5",
84
89
  "strip-json-comments": "5.0.0",
85
- "terser-webpack-plugin": "5.3.6",
90
+ "terser-webpack-plugin": "5.3.7",
86
91
  "toml": "3.0.0",
87
- "ts-loader": "9.4.2",
88
92
  "tv4": "1.3.0",
89
- "typescript": "4.9.4",
90
- "webpack": "5.75.0",
91
- "webpack-cli": "5.0.1"
93
+ "typescript": "5.0.2",
94
+ "webpack": "5.76.3",
95
+ "webpack-cli": "5.0.1",
96
+ "yaml": "2.2.1"
92
97
  },
93
98
  "keywords": [
94
99
  "markdown",
@@ -1,5 +1,5 @@
1
+ // Example markdownlint configuration with all properties set to their default value
1
2
  {
2
- // Example markdownlint JSON(C) configuration with all properties set to their default value
3
3
 
4
4
  // Default state for all rules
5
5
  "default": true,
@@ -1,4 +1,4 @@
1
- # Example markdownlint YAML configuration with all properties set to their default value
1
+ # Example markdownlint configuration with all properties set to their default value
2
2
 
3
3
  # Default state for all rules
4
4
  default: true
@@ -257,6 +257,5 @@ MD052: true
257
257
  # MD053/link-image-reference-definitions - Link and image reference definitions should be needed
258
258
  MD053:
259
259
  # Ignored definitions
260
- ignored_definitions: [
261
- "//"
262
- ]
260
+ ignored_definitions:
261
+ - "//"