markdownlint 0.36.1 → 0.37.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/CHANGELOG.md +7 -0
- package/README.md +70 -117
- package/doc/CustomRules.md +6 -6
- package/helpers/README.md +2 -2
- package/helpers/{helpers.js → helpers.cjs} +15 -6
- package/helpers/micromark-helpers.cjs +5 -3
- package/helpers/package.json +2 -5
- package/lib/{cache.js → cache.mjs} +9 -17
- package/lib/configuration-strict.d.ts +104 -104
- package/lib/configuration.d.ts +1 -1
- package/lib/{constants.js → constants.mjs} +4 -6
- package/lib/exports-async.d.mts +1 -0
- package/lib/exports-async.mjs +3 -0
- package/lib/exports-promise.d.mts +1 -0
- package/lib/exports-promise.mjs +3 -0
- package/lib/exports-sync.d.mts +1 -0
- package/lib/exports-sync.mjs +3 -0
- package/lib/exports.d.mts +28 -0
- package/lib/exports.mjs +31 -0
- package/lib/markdownit.cjs +9 -5
- package/lib/{markdownlint.d.ts → markdownlint.d.mts} +66 -76
- package/lib/{markdownlint.js → markdownlint.mjs} +69 -75
- package/lib/{md001.js → md001.mjs} +5 -8
- package/lib/{md003.js → md003.mjs} +5 -8
- package/lib/{md004.js → md004.mjs} +6 -9
- package/lib/{md005.js → md005.mjs} +4 -7
- package/lib/{md007.js → md007.mjs} +8 -13
- package/lib/{md009.js → md009.mjs} +5 -8
- package/lib/{md010.js → md010.mjs} +7 -11
- package/lib/{md011.js → md011.mjs} +7 -11
- package/lib/{md012.js → md012.mjs} +5 -8
- package/lib/{md013.js → md013.mjs} +8 -9
- package/lib/{md014.js → md014.mjs} +4 -7
- package/lib/{md018.js → md018.mjs} +5 -8
- package/lib/{md019-md021.js → md019-md021.mjs} +7 -10
- package/lib/{md020.js → md020.mjs} +5 -8
- package/lib/{md022.js → md022.mjs} +5 -8
- package/lib/{md023.js → md023.mjs} +4 -7
- package/lib/{md024.js → md024.mjs} +5 -8
- package/lib/{md025.js → md025.mjs} +5 -8
- package/lib/{md026.js → md026.mjs} +5 -8
- package/lib/{md027.js → md027.mjs} +12 -9
- package/lib/{md028.js → md028.mjs} +4 -7
- package/lib/{md029.js → md029.mjs} +6 -9
- package/lib/{md030.js → md030.mjs} +4 -7
- package/lib/{md031.js → md031.mjs} +7 -10
- package/lib/{md032.js → md032.mjs} +5 -8
- package/lib/{md033.js → md033.mjs} +5 -8
- package/lib/{md034.js → md034.mjs} +5 -6
- package/lib/{md035.js → md035.mjs} +4 -7
- package/lib/{md036.js → md036.mjs} +6 -9
- package/lib/{md037.js → md037.mjs} +4 -7
- package/lib/{md038.js → md038.mjs} +5 -8
- package/lib/{md039.js → md039.mjs} +9 -12
- package/lib/{md040.js → md040.mjs} +5 -8
- package/lib/{md041.js → md041.mjs} +4 -8
- package/lib/{md042.js → md042.mjs} +5 -8
- package/lib/{md043.js → md043.mjs} +5 -8
- package/lib/{md044.js → md044.mjs} +8 -11
- package/lib/{md045.js → md045.mjs} +5 -8
- package/lib/{md046.js → md046.mjs} +4 -7
- package/lib/{md047.js → md047.mjs} +3 -6
- package/lib/{md048.js → md048.mjs} +5 -8
- package/lib/{md049-md050.js → md049-md050.mjs} +8 -11
- package/lib/{md051.js → md051.mjs} +8 -12
- package/lib/{md052.js → md052.mjs} +4 -7
- package/lib/{md053.js → md053.mjs} +4 -7
- package/lib/{md054.js → md054.mjs} +5 -8
- package/lib/{md055.js → md055.mjs} +6 -7
- package/lib/{md056.js → md056.mjs} +7 -8
- package/lib/{md058.js → md058.mjs} +6 -7
- package/{helpers/micromark-parse.cjs → lib/micromark-parse.mjs} +29 -33
- package/lib/micromark-types.d.mts +11 -0
- package/lib/rules.mjs +118 -0
- package/lib/types.d.mts +12 -0
- package/package.json +36 -32
- package/schema/.markdownlint.jsonc +51 -51
- package/schema/.markdownlint.yaml +51 -51
- package/schema/markdownlint-config-schema-strict.json +106 -106
- package/schema/markdownlint-config-schema.json +106 -106
- package/demo/markdownlint-browser.js +0 -7138
- package/helpers/test.cjs +0 -28
- package/lib/rules.js +0 -74
- /package/helpers/{shared.js → shared.cjs} +0 -0
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const { getHeadingStyle } = require("../helpers/micromark-helpers.cjs");
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
3
|
+
import { addErrorContext } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getHeadingStyle } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* Validate heading sequence and whitespace length at start or end.
|
|
11
9
|
*
|
|
12
|
-
* @param {import("
|
|
13
|
-
* @param {import("
|
|
10
|
+
* @param {import("markdownlint").RuleOnError} onError Error-reporting callback.
|
|
11
|
+
* @param {import("markdownlint").MicromarkToken} heading ATX heading token.
|
|
14
12
|
* @param {number} delta Direction to scan.
|
|
15
13
|
* @returns {void}
|
|
16
14
|
*/
|
|
@@ -47,9 +45,8 @@ function validateHeadingSpaces(onError, heading, delta) {
|
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
module.exports = [
|
|
48
|
+
/** @type {import("markdownlint").Rule[]} */
|
|
49
|
+
export default [
|
|
53
50
|
{
|
|
54
51
|
"names": [ "MD019", "no-multiple-space-atx" ],
|
|
55
52
|
"description": "Multiple spaces after hash on atx style heading",
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addErrorContext } from "../helpers/helpers.cjs";
|
|
4
|
+
import { addRangeToSet } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
10
|
-
/** @type import("./markdownlint").Rule */
|
|
11
|
-
module.exports = {
|
|
7
|
+
/** @type {import("markdownlint").Rule} */
|
|
8
|
+
export default {
|
|
12
9
|
"names": [ "MD020", "no-missing-space-closed-atx" ],
|
|
13
10
|
"description": "No space inside hashes on closed atx style heading",
|
|
14
11
|
"tags": [ "headings", "atx_closed", "spaces" ],
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const { getBlockQuotePrefixText, getHeadingLevel } = require("../helpers/micromark-helpers.cjs");
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
3
|
+
import { addErrorDetailIf, isBlankLine } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getBlockQuotePrefixText, getHeadingLevel } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
8
6
|
|
|
9
7
|
const defaultLines = 1;
|
|
10
8
|
|
|
@@ -21,9 +19,8 @@ const getLinesFunction = (linesParam) => {
|
|
|
21
19
|
return () => lines;
|
|
22
20
|
};
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
module.exports = {
|
|
22
|
+
/** @type {import("markdownlint").Rule} */
|
|
23
|
+
export default {
|
|
27
24
|
"names": [ "MD022", "blanks-around-headings" ],
|
|
28
25
|
"description": "Headings should be surrounded by blank lines",
|
|
29
26
|
"tags": [ "headings", "blank_lines" ],
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addErrorContext } from "../helpers/helpers.cjs";
|
|
4
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
9
|
-
/** @type import("./markdownlint").Rule */
|
|
10
|
-
module.exports = {
|
|
6
|
+
/** @type {import("markdownlint").Rule} */
|
|
7
|
+
export default {
|
|
11
8
|
"names": [ "MD023", "heading-start-left" ],
|
|
12
9
|
"description": "Headings must start at the beginning of the line",
|
|
13
10
|
"tags": [ "headings", "spaces" ],
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addErrorContext } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getHeadingLevel, getHeadingText } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
10
|
-
/** @type import("./markdownlint").Rule */
|
|
11
|
-
module.exports = {
|
|
7
|
+
/** @type {import("markdownlint").Rule} */
|
|
8
|
+
export default {
|
|
12
9
|
"names": [ "MD024", "no-duplicate-heading" ],
|
|
13
10
|
"description": "Multiple headings with the same content",
|
|
14
11
|
"tags": [ "headings" ],
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addErrorContext, frontMatterHasTitle } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getHeadingLevel, getHeadingText } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
10
|
-
/** @type import("./markdownlint").Rule */
|
|
11
|
-
module.exports = {
|
|
7
|
+
/** @type {import("markdownlint").Rule} */
|
|
8
|
+
export default {
|
|
12
9
|
"names": [ "MD025", "single-title", "single-h1" ],
|
|
13
10
|
"description": "Multiple top-level headings in the same document",
|
|
14
11
|
"tags": [ "headings" ],
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addError, allPunctuationNoQuestion, endOfLineGemojiCodeRe,
|
|
4
|
+
endOfLineHtmlEntityRe, escapeForRegExp } from "../helpers/helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
10
|
-
/** @type import("./markdownlint").Rule */
|
|
11
|
-
module.exports = {
|
|
7
|
+
/** @type {import("markdownlint").Rule} */
|
|
8
|
+
export default {
|
|
12
9
|
"names": [ "MD026", "no-trailing-punctuation" ],
|
|
13
10
|
"description": "Trailing punctuation in heading",
|
|
14
11
|
"tags": [ "headings" ],
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addErrorContext } from "../helpers/helpers.cjs";
|
|
4
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
9
|
-
/** @type import("./markdownlint").Rule */
|
|
10
|
-
module.exports = {
|
|
6
|
+
/** @type {import("markdownlint").Rule} */
|
|
7
|
+
export default {
|
|
11
8
|
"names": [ "MD027", "no-multiple-space-blockquote" ],
|
|
12
9
|
"description": "Multiple spaces after blockquote symbol",
|
|
13
10
|
"tags": [ "blockquote", "whitespace", "indentation" ],
|
|
14
11
|
"parser": "micromark",
|
|
15
12
|
"function": function MD027(params, onError) {
|
|
13
|
+
const { tokens } = params.parsers.micromark;
|
|
16
14
|
for (const token of filterByTypesCached([ "linePrefix" ])) {
|
|
17
|
-
const
|
|
18
|
-
|
|
15
|
+
const parent = token.parent;
|
|
16
|
+
const codeIndented = parent?.type === "codeIndented";
|
|
17
|
+
const siblings = parent?.children || tokens;
|
|
18
|
+
if (
|
|
19
|
+
!codeIndented &&
|
|
20
|
+
(siblings[siblings.indexOf(token) - 1]?.type === "blockQuotePrefix")
|
|
21
|
+
) {
|
|
19
22
|
const { startColumn, startLine, text } = token;
|
|
20
23
|
const { length } = text;
|
|
21
24
|
const line = params.lines[startLine - 1];
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const { addError } = require("../helpers");
|
|
6
|
-
const { filterByTypesCached } = require("./cache");
|
|
3
|
+
import { addError } from "../helpers/helpers.cjs";
|
|
4
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
7
5
|
|
|
8
6
|
const ignoreTypes = new Set([ "lineEnding", "listItemIndent", "linePrefix" ]);
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
module.exports = {
|
|
8
|
+
/** @type {import("markdownlint").Rule} */
|
|
9
|
+
export default {
|
|
13
10
|
"names": [ "MD028", "no-blanks-blockquote" ],
|
|
14
11
|
"description": "Blank line inside blockquote",
|
|
15
12
|
"tags": [ "blockquote", "whitespace" ],
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const { getDescendantsByType } = require("../helpers/micromark-helpers.cjs");
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
3
|
+
import { addErrorDetailIf } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getDescendantsByType } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
8
6
|
|
|
9
7
|
const listStyleExamples = {
|
|
10
8
|
"one": "1/1/1",
|
|
@@ -15,16 +13,15 @@ const listStyleExamples = {
|
|
|
15
13
|
/**
|
|
16
14
|
* Gets the value of an ordered list item prefix token.
|
|
17
15
|
*
|
|
18
|
-
* @param {import("
|
|
16
|
+
* @param {import("markdownlint").MicromarkToken} listItemPrefix List item prefix token.
|
|
19
17
|
* @returns {number} List item value.
|
|
20
18
|
*/
|
|
21
19
|
function getOrderedListItemValue(listItemPrefix) {
|
|
22
20
|
return Number(getDescendantsByType(listItemPrefix, [ "listItemValue" ])[0].text);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
module.exports = {
|
|
23
|
+
/** @type {import("markdownlint").Rule} */
|
|
24
|
+
export default {
|
|
28
25
|
"names": [ "MD029", "ol-prefix" ],
|
|
29
26
|
"description": "Ordered list item prefix",
|
|
30
27
|
"tags": [ "ol" ],
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addErrorDetailIf } from "../helpers/helpers.cjs";
|
|
4
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
9
|
-
/** @type import("./markdownlint").Rule */
|
|
10
|
-
module.exports = {
|
|
6
|
+
/** @type {import("markdownlint").Rule} */
|
|
7
|
+
export default {
|
|
11
8
|
"names": [ "MD030", "list-marker-space" ],
|
|
12
9
|
"description": "Spaces after list markers",
|
|
13
10
|
"tags": [ "ol", "ul", "whitespace" ],
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const { getParentOfType } = require("../helpers/micromark-helpers.cjs");
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
3
|
+
import { addErrorContext, isBlankLine } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getParentOfType } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
8
6
|
|
|
9
7
|
const codeFencePrefixRe = /^(.*?)[`~]/;
|
|
10
8
|
|
|
@@ -14,7 +12,7 @@ const codeFencePrefixRe = /^(.*?)[`~]/;
|
|
|
14
12
|
/**
|
|
15
13
|
* Adds an error for the top or bottom of a code fence.
|
|
16
14
|
*
|
|
17
|
-
* @param {import("
|
|
15
|
+
* @param {import("markdownlint").RuleOnError} onError Error-reporting callback.
|
|
18
16
|
* @param {ReadonlyStringArray} lines Lines of Markdown content.
|
|
19
17
|
* @param {number} lineNumber Line number.
|
|
20
18
|
* @param {boolean} top True iff top fence.
|
|
@@ -24,7 +22,7 @@ function addError(onError, lines, lineNumber, top) {
|
|
|
24
22
|
const line = lines[lineNumber - 1];
|
|
25
23
|
const [ , prefix ] = line.match(codeFencePrefixRe) || [];
|
|
26
24
|
const fixInfo = (prefix === undefined) ?
|
|
27
|
-
|
|
25
|
+
undefined :
|
|
28
26
|
{
|
|
29
27
|
"lineNumber": lineNumber + (top ? 0 : 1),
|
|
30
28
|
"insertText": `${prefix.replace(/[^>]/g, " ").trim()}\n`
|
|
@@ -40,9 +38,8 @@ function addError(onError, lines, lineNumber, top) {
|
|
|
40
38
|
);
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
module.exports = {
|
|
41
|
+
/** @type {import("markdownlint").Rule} */
|
|
42
|
+
export default {
|
|
46
43
|
"names": [ "MD031", "blanks-around-fences" ],
|
|
47
44
|
"description": "Fenced code blocks should be surrounded by blank lines",
|
|
48
45
|
"tags": [ "code", "blank_lines" ],
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const { filterByPredicate, getBlockQuotePrefixText, nonContentTokens } = require("../helpers/micromark-helpers.cjs");
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
3
|
+
import { addErrorContext, isBlankLine } from "../helpers/helpers.cjs";
|
|
4
|
+
import { filterByPredicate, getBlockQuotePrefixText, nonContentTokens } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
8
6
|
|
|
9
7
|
const isList = (token) => (
|
|
10
8
|
(token.type === "listOrdered") || (token.type === "listUnordered")
|
|
11
9
|
);
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
module.exports = {
|
|
11
|
+
/** @type {import("markdownlint").Rule} */
|
|
12
|
+
export default {
|
|
16
13
|
"names": [ "MD032", "blanks-around-lists" ],
|
|
17
14
|
"description": "Lists should be surrounded by blank lines",
|
|
18
15
|
"tags": [ "bullet", "ul", "ol", "blank_lines" ],
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addError, nextLinesRe } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getHtmlTagInfo } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
10
|
-
/** @type import("./markdownlint").Rule */
|
|
11
|
-
module.exports = {
|
|
7
|
+
/** @type {import("markdownlint").Rule} */
|
|
8
|
+
export default {
|
|
12
9
|
"names": [ "MD033", "no-inline-html" ],
|
|
13
10
|
"description": "Inline HTML",
|
|
14
11
|
"tags": [ "html" ],
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addErrorContext } from "../helpers/helpers.cjs";
|
|
4
|
+
import { filterByPredicate, getHtmlTagInfo, inHtmlFlow } from "../helpers/micromark-helpers.cjs";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
const { filterByPredicate, getHtmlTagInfo, inHtmlFlow } = require("../helpers/micromark-helpers.cjs");
|
|
6
|
+
/** @typedef {import("micromark-extension-gfm-autolink-literal")} */
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
8
|
+
/** @type {import("markdownlint").Rule} */
|
|
9
|
+
export default {
|
|
11
10
|
"names": [ "MD034", "no-bare-urls" ],
|
|
12
11
|
"description": "Bare URL used",
|
|
13
12
|
"tags": [ "links", "url" ],
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addErrorDetailIf } from "../helpers/helpers.cjs";
|
|
4
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
9
|
-
/** @type import("./markdownlint").Rule */
|
|
10
|
-
module.exports = {
|
|
6
|
+
/** @type {import("markdownlint").Rule} */
|
|
7
|
+
export default {
|
|
11
8
|
"names": [ "MD035", "hr-style" ],
|
|
12
9
|
"description": "Horizontal rule style",
|
|
13
10
|
"tags": [ "hr" ],
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addErrorContext, allPunctuation } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getDescendantsByType } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
const { getDescendantsByType } = require("../helpers/micromark-helpers.cjs");
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
8
|
-
|
|
9
|
-
/** @typedef {import("../helpers/micromark-helpers.cjs").TokenType} TokenType */
|
|
7
|
+
/** @typedef {import("markdownlint").MicromarkTokenType} TokenType */
|
|
10
8
|
/** @type {TokenType[][]} */
|
|
11
9
|
const emphasisTypes = [
|
|
12
10
|
[ "emphasis", "emphasisText" ],
|
|
13
11
|
[ "strong", "strongText" ]
|
|
14
12
|
];
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
module.exports = {
|
|
14
|
+
/** @type {import("markdownlint").Rule} */
|
|
15
|
+
export default {
|
|
19
16
|
"names": [ "MD036", "no-emphasis-as-heading" ],
|
|
20
17
|
"description": "Emphasis used instead of a heading",
|
|
21
18
|
"tags": [ "headings", "emphasis" ],
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addError } from "../helpers/helpers.cjs";
|
|
4
|
+
import { filterByPredicate, inHtmlFlow } from "../helpers/micromark-helpers.cjs";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
9
|
-
/** @type import("./markdownlint").Rule */
|
|
10
|
-
module.exports = {
|
|
6
|
+
/** @type {import("markdownlint").Rule} */
|
|
7
|
+
export default {
|
|
11
8
|
"names": [ "MD037", "no-space-in-emphasis" ],
|
|
12
9
|
"description": "Spaces inside emphasis markers",
|
|
13
10
|
"tags": [ "whitespace", "emphasis" ],
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const { getDescendantsByType } = require("../helpers/micromark-helpers.cjs");
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
3
|
+
import { addErrorContext } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getDescendantsByType } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
8
6
|
|
|
9
7
|
const leftSpaceRe = /^\s(?:[^`]|$)/;
|
|
10
8
|
const rightSpaceRe = /[^`]\s$/;
|
|
@@ -19,9 +17,8 @@ const trimCodeText = (text, start, end) => {
|
|
|
19
17
|
return text;
|
|
20
18
|
};
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
module.exports = {
|
|
20
|
+
/** @type {import("markdownlint").Rule} */
|
|
21
|
+
export default {
|
|
25
22
|
"names": [ "MD038", "no-space-in-code" ],
|
|
26
23
|
"description": "Spaces inside code span elements",
|
|
27
24
|
"tags": [ "whitespace", "code" ],
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const { addErrorContext } = require("../helpers");
|
|
6
|
-
const { getReferenceLinkImageData, filterByTypesCached } = require("./cache");
|
|
3
|
+
import { addErrorContext } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getReferenceLinkImageData, filterByTypesCached } from "./cache.mjs";
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* Adds an error for a label space issue.
|
|
10
8
|
*
|
|
11
|
-
* @param {import("
|
|
12
|
-
* @param {import("
|
|
13
|
-
* @param {import("
|
|
9
|
+
* @param {import("markdownlint").RuleOnError} onError Error-reporting callback.
|
|
10
|
+
* @param {import("markdownlint").MicromarkToken} label Label token.
|
|
11
|
+
* @param {import("markdownlint").MicromarkToken} labelText LabelText token.
|
|
14
12
|
* @param {boolean} isStart True iff error is at the start of the link.
|
|
15
13
|
*/
|
|
16
14
|
function addLabelSpaceError(onError, label, labelText, isStart) {
|
|
@@ -40,8 +38,8 @@ function addLabelSpaceError(onError, label, labelText, isStart) {
|
|
|
40
38
|
/**
|
|
41
39
|
* Determines if a link is a valid link (and not a fake shortcut link due to parser tricks).
|
|
42
40
|
*
|
|
43
|
-
* @param {import("
|
|
44
|
-
* @param {import("
|
|
41
|
+
* @param {import("markdownlint").MicromarkToken} label Label token.
|
|
42
|
+
* @param {import("markdownlint").MicromarkToken} labelText LabelText token.
|
|
45
43
|
* @param {Map<string, any>} definitions Map of link definitions.
|
|
46
44
|
* @returns {boolean} True iff the link is valid.
|
|
47
45
|
*/
|
|
@@ -49,9 +47,8 @@ function validLink(label, labelText, definitions) {
|
|
|
49
47
|
return (label.parent?.children.length !== 1) || definitions.has(labelText.text.trim());
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
module.exports = {
|
|
50
|
+
/** @type {import("markdownlint").Rule} */
|
|
51
|
+
export default {
|
|
55
52
|
"names": [ "MD039", "no-space-in-links" ],
|
|
56
53
|
"description": "Spaces inside link text",
|
|
57
54
|
"tags": [ "whitespace", "links" ],
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addError, addErrorContext } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getDescendantsByType } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
10
|
-
/** @type import("./markdownlint").Rule */
|
|
11
|
-
module.exports = {
|
|
7
|
+
/** @type {import("markdownlint").Rule} */
|
|
8
|
+
export default {
|
|
12
9
|
"names": [ "MD040", "fenced-code-language" ],
|
|
13
10
|
"description": "Fenced code blocks should have a language specified",
|
|
14
11
|
"tags": [ "code", "language" ],
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addErrorContext, frontMatterHasTitle } from "../helpers/helpers.cjs";
|
|
4
|
+
import { filterByTypes, getHeadingLevel, getHtmlTagInfo, isHtmlFlowComment, nonContentTokens } from "../helpers/micromark-helpers.cjs";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
require("../helpers/micromark-helpers.cjs");
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
10
|
-
/** @type import("./markdownlint").Rule */
|
|
11
|
-
module.exports = {
|
|
6
|
+
/** @type {import("markdownlint").Rule} */
|
|
7
|
+
export default {
|
|
12
8
|
"names": [ "MD041", "first-line-heading", "first-line-h1" ],
|
|
13
9
|
"description": "First line in a file should be a top-level heading",
|
|
14
10
|
"tags": [ "headings" ],
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addErrorContext } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getDescendantsByType } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { getReferenceLinkImageData, filterByTypesCached } from "./cache.mjs";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { getReferenceLinkImageData, filterByTypesCached } = require("./cache");
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
10
|
-
/** @type import("./markdownlint").Rule */
|
|
11
|
-
module.exports = {
|
|
7
|
+
/** @type {import("markdownlint").Rule} */
|
|
8
|
+
export default {
|
|
12
9
|
"names": [ "MD042", "no-empty-links" ],
|
|
13
10
|
"description": "No empty links",
|
|
14
11
|
"tags": [ "links" ],
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { addErrorContext, addErrorDetailIf } from "../helpers/helpers.cjs";
|
|
4
|
+
import { getHeadingLevel, getHeadingText } from "../helpers/micromark-helpers.cjs";
|
|
5
|
+
import { filterByTypesCached } from "./cache.mjs";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { filterByTypesCached } = require("./cache");
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line jsdoc/valid-types
|
|
10
|
-
/** @type import("./markdownlint").Rule */
|
|
11
|
-
module.exports = {
|
|
7
|
+
/** @type {import("markdownlint").Rule} */
|
|
8
|
+
export default {
|
|
12
9
|
"names": [ "MD043", "required-headings" ],
|
|
13
10
|
"description": "Required heading structure",
|
|
14
11
|
"tags": [ "headings" ],
|