Reimplement MD021/no-multiple-space-closed-atx using micromark tokens.

This commit is contained in:
David Anson 2024-06-15 15:45:04 -07:00
parent e3ca9b1755
commit 0b165c1566
8 changed files with 393 additions and 219 deletions

View file

@ -312,17 +312,6 @@ function indentFor(token) {
} }
module.exports.indentFor = indentFor; module.exports.indentFor = indentFor;
// Returns the heading style for a heading token
module.exports.headingStyleFor = function headingStyleFor(token) {
if ((token.map[1] - token.map[0]) === 1) {
if (/[^\\]#\s*$/.test(token.line)) {
return "atx_closed";
}
return "atx";
}
return "setext";
};
/** /**
* Return the string representation of an unordered list marker. * Return the string representation of an unordered list marker.
* *
@ -4264,8 +4253,8 @@ module.exports = {
onError, onError,
atxHeading.startLine, atxHeading.startLine,
atxHeading.text.trim(), atxHeading.text.trim(),
undefined, true,
undefined, false,
[ column, length ], [ column, length ],
{ {
"editColumn": column, "editColumn": column,
@ -4367,65 +4356,73 @@ module.exports = {
const { addErrorContext, filterTokens, headingStyleFor } = const { addErrorContext } = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js");
__webpack_require__(/*! ../helpers */ "../helpers/helpers.js"); const { filterByTypes, getHeadingStyle } = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs");
const closedAtxRe = /^(#+)([ \t]+)([^ \t]|[^ \t].*[^ \t])([ \t]+)(#+)(\s*)$/;
// eslint-disable-next-line jsdoc/valid-types // eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */ /** @type import("./markdownlint").Rule */
module.exports = { module.exports = {
"names": [ "MD021", "no-multiple-space-closed-atx" ], "names": [ "MD021", "no-multiple-space-closed-atx" ],
"description": "Multiple spaces inside hashes on closed atx style heading", "description": "Multiple spaces inside hashes on closed atx style heading",
"tags": [ "headings", "atx_closed", "spaces" ], "tags": [ "headings", "atx_closed", "spaces" ],
"parser": "markdownit", "parser": "micromark",
"function": function MD021(params, onError) { "function": function MD021(params, onError) {
filterTokens(params, "heading_open", (token) => { const atxHeadings = filterByTypes(
if (headingStyleFor(token) === "atx_closed") { params.parsers.micromark.tokens,
const { line, lineNumber } = token; [ "atxHeading" ]
const match = closedAtxRe.exec(line); ).filter((heading) => getHeadingStyle(heading) === "atx_closed");
if (match) { for (const atxHeading of atxHeadings) {
const [ const [ atxHeadingSequenceStart, whitespaceStart ] = atxHeading.children;
, if (
leftHash, (atxHeadingSequenceStart?.type === "atxHeadingSequence") &&
{ "length": leftSpaceLength }, (whitespaceStart?.type === "whitespace") &&
content, (whitespaceStart.text.length > 1)
{ "length": rightSpaceLength }, ) {
rightHash, const column = whitespaceStart.startColumn + 1;
{ "length": trailSpaceLength } const length = whitespaceStart.endColumn - column;
] = match; addErrorContext(
const left = leftSpaceLength > 1; onError,
const right = rightSpaceLength > 1; atxHeading.startLine,
if (left || right) { atxHeading.text.trim(),
const length = line.length; true,
const leftHashLength = leftHash.length; false,
const rightHashLength = rightHash.length; [ column, length ],
const range = left ? {
[ "editColumn": column,
1, "deleteCount": length
leftHashLength + leftSpaceLength + 1
] :
[
length - trailSpaceLength - rightHashLength - rightSpaceLength,
rightSpaceLength + rightHashLength + 1
];
addErrorContext(
onError,
lineNumber,
line.trim(),
left,
right,
range,
{
"editColumn": 1,
"deleteCount": length,
"insertText": `${leftHash} ${content} ${rightHash}`
}
);
} }
} );
} }
}); let endSequenceIndex = atxHeading.children.length - 1;
while (
(endSequenceIndex > 1) &&
(atxHeading.children[endSequenceIndex].type !== "atxHeadingSequence")
) {
endSequenceIndex--;
}
const atxHeadingSequenceEnd = atxHeading.children.at(endSequenceIndex);
const whitespaceEnd = atxHeading.children.at(endSequenceIndex - 1);
if (
(atxHeadingSequenceEnd?.type === "atxHeadingSequence") &&
(whitespaceEnd?.type === "whitespace") &&
(whitespaceEnd.text.length > 1)
) {
const column = whitespaceEnd.startColumn + 1;
const length = whitespaceEnd.endColumn - column;
addErrorContext(
onError,
atxHeading.startLine,
atxHeading.text.trim(),
false,
true,
[ column, length ],
{
"editColumn": column,
"deleteCount": length
}
);
}
}
} }
}; };

View file

@ -300,17 +300,6 @@ function indentFor(token) {
} }
module.exports.indentFor = indentFor; module.exports.indentFor = indentFor;
// Returns the heading style for a heading token
module.exports.headingStyleFor = function headingStyleFor(token) {
if ((token.map[1] - token.map[0]) === 1) {
if (/[^\\]#\s*$/.test(token.line)) {
return "atx_closed";
}
return "atx";
}
return "setext";
};
/** /**
* Return the string representation of an unordered list marker. * Return the string representation of an unordered list marker.
* *

View file

@ -30,8 +30,8 @@ module.exports = {
onError, onError,
atxHeading.startLine, atxHeading.startLine,
atxHeading.text.trim(), atxHeading.text.trim(),
undefined, true,
undefined, false,
[ column, length ], [ column, length ],
{ {
"editColumn": column, "editColumn": column,

View file

@ -2,64 +2,72 @@
"use strict"; "use strict";
const { addErrorContext, filterTokens, headingStyleFor } = const { addErrorContext } = require("../helpers");
require("../helpers"); const { filterByTypes, getHeadingStyle } = require("../helpers/micromark.cjs");
const closedAtxRe = /^(#+)([ \t]+)([^ \t]|[^ \t].*[^ \t])([ \t]+)(#+)(\s*)$/;
// eslint-disable-next-line jsdoc/valid-types // eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */ /** @type import("./markdownlint").Rule */
module.exports = { module.exports = {
"names": [ "MD021", "no-multiple-space-closed-atx" ], "names": [ "MD021", "no-multiple-space-closed-atx" ],
"description": "Multiple spaces inside hashes on closed atx style heading", "description": "Multiple spaces inside hashes on closed atx style heading",
"tags": [ "headings", "atx_closed", "spaces" ], "tags": [ "headings", "atx_closed", "spaces" ],
"parser": "markdownit", "parser": "micromark",
"function": function MD021(params, onError) { "function": function MD021(params, onError) {
filterTokens(params, "heading_open", (token) => { const atxHeadings = filterByTypes(
if (headingStyleFor(token) === "atx_closed") { params.parsers.micromark.tokens,
const { line, lineNumber } = token; [ "atxHeading" ]
const match = closedAtxRe.exec(line); ).filter((heading) => getHeadingStyle(heading) === "atx_closed");
if (match) { for (const atxHeading of atxHeadings) {
const [ const [ atxHeadingSequenceStart, whitespaceStart ] = atxHeading.children;
, if (
leftHash, (atxHeadingSequenceStart?.type === "atxHeadingSequence") &&
{ "length": leftSpaceLength }, (whitespaceStart?.type === "whitespace") &&
content, (whitespaceStart.text.length > 1)
{ "length": rightSpaceLength }, ) {
rightHash, const column = whitespaceStart.startColumn + 1;
{ "length": trailSpaceLength } const length = whitespaceStart.endColumn - column;
] = match; addErrorContext(
const left = leftSpaceLength > 1; onError,
const right = rightSpaceLength > 1; atxHeading.startLine,
if (left || right) { atxHeading.text.trim(),
const length = line.length; true,
const leftHashLength = leftHash.length; false,
const rightHashLength = rightHash.length; [ column, length ],
const range = left ? {
[ "editColumn": column,
1, "deleteCount": length
leftHashLength + leftSpaceLength + 1
] :
[
length - trailSpaceLength - rightHashLength - rightSpaceLength,
rightSpaceLength + rightHashLength + 1
];
addErrorContext(
onError,
lineNumber,
line.trim(),
left,
right,
range,
{
"editColumn": 1,
"deleteCount": length,
"insertText": `${leftHash} ${content} ${rightHash}`
}
);
} }
} );
} }
}); let endSequenceIndex = atxHeading.children.length - 1;
while (
(endSequenceIndex > 1) &&
(atxHeading.children[endSequenceIndex].type !== "atxHeadingSequence")
) {
endSequenceIndex--;
}
const atxHeadingSequenceEnd = atxHeading.children.at(endSequenceIndex);
const whitespaceEnd = atxHeading.children.at(endSequenceIndex - 1);
if (
(atxHeadingSequenceEnd?.type === "atxHeadingSequence") &&
(whitespaceEnd?.type === "whitespace") &&
(whitespaceEnd.text.length > 1)
) {
const column = whitespaceEnd.startColumn + 1;
const length = whitespaceEnd.endColumn - column;
addErrorContext(
onError,
atxHeading.startLine,
atxHeading.text.trim(),
false,
true,
[ column, length ],
{
"editColumn": column,
"deleteCount": length
}
);
}
}
} }
}; };

View file

@ -977,3 +977,11 @@ test("endOfLineGemojiCodeRe", async(t) => {
t.true(helpers.endOfLineGemojiCodeRe.test(`-:${emoji}:`), emoji); t.true(helpers.endOfLineGemojiCodeRe.test(`-:${emoji}:`), emoji);
} }
}); });
test("ellipsify", (t) => {
t.is(helpers.ellipsify("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), "abcdefghijklmnopqrstuvwxyzABCD...");
t.is(helpers.ellipsify("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", false, false), "abcdefghijklmnopqrstuvwxyzABCD...");
t.is(helpers.ellipsify("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", true, false), "abcdefghijklmnopqrstuvwxyzABCD...");
t.is(helpers.ellipsify("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", false, true), "...wxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
t.is(helpers.ellipsify("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", true, true), "abcdefghijklmno...LMNOPQRSTUVWXYZ");
});

View file

@ -167,8 +167,8 @@ test("resultFormattingV1", (t) => new Promise((resolve) => {
"Multiple spaces inside hashes on closed atx style heading", "Multiple spaces inside hashes on closed atx style heading",
"ruleInformation": `${homepage}/blob/v${version}/doc/md021.md`, "ruleInformation": `${homepage}/blob/v${version}/doc/md021.md`,
"errorDetail": null, "errorDetail": null,
"errorContext": "# Multiple spa...tyle heading #", "errorContext": "# Multiple spaces inside hash...",
"errorRange": [ 1, 4 ] } "errorRange": [ 3, 1 ] }
], ],
"./test/atx_heading_spacing.md": [ "./test/atx_heading_spacing.md": [
{ "lineNumber": 1, { "lineNumber": 1,
@ -237,7 +237,7 @@ test("resultFormattingV1", (t) => new Promise((resolve) => {
" [Context: \"## Heading\"]\n" + " [Context: \"## Heading\"]\n" +
"truncate: 1: MD021/no-multiple-space-closed-atx" + "truncate: 1: MD021/no-multiple-space-closed-atx" +
" Multiple spaces inside hashes on closed atx style heading" + " Multiple spaces inside hashes on closed atx style heading" +
" [Context: \"# Multiple spa...tyle heading #\"]"; " [Context: \"# Multiple spaces inside hash...\"]";
t.is(actualMessage, expectedMessage, "Incorrect message."); t.is(actualMessage, expectedMessage, "Incorrect message.");
resolve(); resolve();
}); });
@ -270,8 +270,8 @@ test("resultFormattingV2", (t) => new Promise((resolve) => {
"Multiple spaces inside hashes on closed atx style heading", "Multiple spaces inside hashes on closed atx style heading",
"ruleInformation": `${homepage}/blob/v${version}/doc/md021.md`, "ruleInformation": `${homepage}/blob/v${version}/doc/md021.md`,
"errorDetail": null, "errorDetail": null,
"errorContext": "# Multiple spa...tyle heading #", "errorContext": "# Multiple spaces inside hash...",
"errorRange": [ 1, 4 ] } "errorRange": [ 3, 1 ] }
], ],
"./test/atx_heading_spacing.md": [ "./test/atx_heading_spacing.md": [
{ "lineNumber": 1, { "lineNumber": 1,
@ -336,7 +336,7 @@ test("resultFormattingV2", (t) => new Promise((resolve) => {
" [Context: \"## Heading\"]\n" + " [Context: \"## Heading\"]\n" +
"truncate: 1: MD021/no-multiple-space-closed-atx" + "truncate: 1: MD021/no-multiple-space-closed-atx" +
" Multiple spaces inside hashes on closed atx style heading" + " Multiple spaces inside hashes on closed atx style heading" +
" [Context: \"# Multiple spa...tyle heading #\"]"; " [Context: \"# Multiple spaces inside hash...\"]";
t.is(actualMessage, expectedMessage, "Incorrect message."); t.is(actualMessage, expectedMessage, "Incorrect message.");
resolve(); resolve();
}); });

View file

@ -524,13 +524,12 @@ Generated by [AVA](https://avajs.dev).
errorContext: '## Multiple spaces E {MD021} ...', errorContext: '## Multiple spaces E {MD021} ...',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
4,
1, 1,
5,
], ],
fixInfo: { fixInfo: {
deleteCount: 32, deleteCount: 1,
editColumn: 1, editColumn: 4,
insertText: '## Multiple spaces E {MD021} ##',
}, },
lineNumber: 22, lineNumber: 22,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -544,13 +543,12 @@ Generated by [AVA](https://avajs.dev).
errorContext: '... Multiple spaces F {MD021} ##', errorContext: '... Multiple spaces F {MD021} ##',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
28, 30,
5, 1,
], ],
fixInfo: { fixInfo: {
deleteCount: 32, deleteCount: 1,
editColumn: 1, editColumn: 30,
insertText: '## Multiple spaces F {MD021} ##',
}, },
lineNumber: 24, lineNumber: 24,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -2701,13 +2699,12 @@ Generated by [AVA](https://avajs.dev).
errorContext: '## Heading 5 {MD021} ##', errorContext: '## Heading 5 {MD021} ##',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
1, 4,
7, 3,
], ],
fixInfo: { fixInfo: {
deleteCount: 28, deleteCount: 3,
editColumn: 1, editColumn: 4,
insertText: '## Heading 5 {MD021} ##',
}, },
lineNumber: 15, lineNumber: 15,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -2721,13 +2718,12 @@ Generated by [AVA](https://avajs.dev).
errorContext: '## Heading 6 {MD021} ##', errorContext: '## Heading 6 {MD021} ##',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
20, 22,
6, 2,
], ],
fixInfo: { fixInfo: {
deleteCount: 27, deleteCount: 2,
editColumn: 1, editColumn: 22,
insertText: '## Heading 6 {MD021} ##',
}, },
lineNumber: 17, lineNumber: 17,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -2741,13 +2737,31 @@ Generated by [AVA](https://avajs.dev).
errorContext: '## Heading 7 {MD021} ##', errorContext: '## Heading 7 {MD021} ##',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
1, 4,
7, 3,
], ],
fixInfo: { fixInfo: {
deleteCount: 30, deleteCount: 3,
editColumn: 1, editColumn: 4,
insertText: '## Heading 7 {MD021} ##', },
lineNumber: 19,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md021.md',
ruleNames: [
'MD021',
'no-multiple-space-closed-atx',
],
},
{
errorContext: '## Heading 7 {MD021} ##',
errorDetail: null,
errorRange: [
25,
2,
],
fixInfo: {
deleteCount: 2,
editColumn: 25,
}, },
lineNumber: 19, lineNumber: 19,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -2772,11 +2786,11 @@ Generated by [AVA](https://avajs.dev).
## Heading 5 {MD020} ##␊ ## Heading 5 {MD020} ##␊
## Heading 5 {MD021} ##␊ ## Heading 5 {MD021} ##
## Heading 6 {MD021} ##␊ ## Heading 6 {MD021} ##
## Heading 7 {MD021} ##␊ ## Heading 7 {MD021} ##
`, `,
} }
@ -2850,13 +2864,12 @@ Generated by [AVA](https://avajs.dev).
errorContext: '## Heading 4 {MD021} ##', errorContext: '## Heading 4 {MD021} ##',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
4,
1, 1,
5,
], ],
fixInfo: { fixInfo: {
deleteCount: 24, deleteCount: 1,
editColumn: 1, editColumn: 4,
insertText: '## Heading 4 {MD021} ##',
}, },
lineNumber: 7, lineNumber: 7,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -2870,13 +2883,12 @@ Generated by [AVA](https://avajs.dev).
errorContext: '## Heading 5 {MD021} ##', errorContext: '## Heading 5 {MD021} ##',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
20, 22,
5, 1,
], ],
fixInfo: { fixInfo: {
deleteCount: 24, deleteCount: 1,
editColumn: 1, editColumn: 22,
insertText: '## Heading 5 {MD021} ##',
}, },
lineNumber: 9, lineNumber: 9,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -2890,13 +2902,31 @@ Generated by [AVA](https://avajs.dev).
errorContext: '## Heading 6 {MD021} ##', errorContext: '## Heading 6 {MD021} ##',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
4,
1, 1,
5,
], ],
fixInfo: { fixInfo: {
deleteCount: 25, deleteCount: 1,
editColumn: 1, editColumn: 4,
insertText: '## Heading 6 {MD021} ##', },
lineNumber: 11,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md021.md',
ruleNames: [
'MD021',
'no-multiple-space-closed-atx',
],
},
{
errorContext: '## Heading 6 {MD021} ##',
errorDetail: null,
errorRange: [
23,
1,
],
fixInfo: {
deleteCount: 1,
editColumn: 23,
}, },
lineNumber: 11, lineNumber: 11,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -2910,13 +2940,31 @@ Generated by [AVA](https://avajs.dev).
errorContext: '## Heading 7 {MD021} ##', errorContext: '## Heading 7 {MD021} ##',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
1, 4,
6, 2,
], ],
fixInfo: { fixInfo: {
deleteCount: 27, deleteCount: 2,
editColumn: 1, editColumn: 4,
insertText: '## Heading 7 {MD021} ##', },
lineNumber: 13,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md021.md',
ruleNames: [
'MD021',
'no-multiple-space-closed-atx',
],
},
{
errorContext: '## Heading 7 {MD021} ##',
errorDetail: null,
errorRange: [
24,
2,
],
fixInfo: {
deleteCount: 2,
editColumn: 24,
}, },
lineNumber: 13, lineNumber: 13,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -7035,16 +7083,34 @@ Generated by [AVA](https://avajs.dev).
], ],
}, },
{ {
errorContext: '# Heading 7 {M...021} {MD003} #', errorContext: '# Heading 7 {MD021} {MD003} ...',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
3,
1, 1,
4,
], ],
fixInfo: { fixInfo: {
deleteCount: 31, deleteCount: 1,
editColumn: 1, editColumn: 3,
insertText: '# Heading 7 {MD021} {MD003} #', },
lineNumber: 31,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md021.md',
ruleNames: [
'MD021',
'no-multiple-space-closed-atx',
],
},
{
errorContext: '... Heading 7 {MD021} {MD003} #',
errorDetail: null,
errorRange: [
30,
1,
],
fixInfo: {
deleteCount: 1,
editColumn: 30,
}, },
lineNumber: 31, lineNumber: 31,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -15927,16 +15993,34 @@ Generated by [AVA](https://avajs.dev).
], ],
}, },
{ {
errorContext: '## Extra Norma...th) {MD021} ##', errorContext: '## Extra Normal space (both) ...',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
4,
1, 1,
5,
], ],
fixInfo: { fixInfo: {
deleteCount: 41, deleteCount: 1,
editColumn: 1, editColumn: 4,
insertText: '## Extra Normal space (both) {MD021} ##', },
lineNumber: 29,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md021.md',
ruleNames: [
'MD021',
'no-multiple-space-closed-atx',
],
},
{
errorContext: '...ormal space (both) {MD021} ##',
errorDetail: null,
errorRange: [
39,
1,
],
fixInfo: {
deleteCount: 1,
editColumn: 39,
}, },
lineNumber: 29, lineNumber: 29,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -15950,13 +16034,12 @@ Generated by [AVA](https://avajs.dev).
errorContext: '## Extra tab (left) {MD021} #...', errorContext: '## Extra tab (left) {MD021} #...',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
4,
1, 1,
5,
], ],
fixInfo: { fixInfo: {
deleteCount: 31, deleteCount: 1,
editColumn: 1, editColumn: 4,
insertText: '## Extra tab (left) {MD021} ##',
}, },
lineNumber: 33, lineNumber: 33,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -15970,13 +16053,12 @@ Generated by [AVA](https://avajs.dev).
errorContext: '... Extra tab (right) {MD021} ##', errorContext: '... Extra tab (right) {MD021} ##',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
28, 30,
5, 1,
], ],
fixInfo: { fixInfo: {
deleteCount: 32, deleteCount: 1,
editColumn: 1, editColumn: 30,
insertText: '## Extra tab (right) {MD021} ##',
}, },
lineNumber: 37, lineNumber: 37,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -16019,11 +16101,11 @@ Generated by [AVA](https://avajs.dev).
##   Extra non-breaking space (left) {MD020} ##␊ ##   Extra non-breaking space (left) {MD020} ##␊
## Extra tab (left) {MD021} ##␊ ## Extra tab (left) {MD021} ##␊
## Extra non-breaking space (right) {MD020}   ##␊ ## Extra non-breaking space (right) {MD020}   ##␊
## Extra tab (right) {MD021} ##␊ ## Extra tab (right) {MD021} ##␊
<!-- markdownlint-configure-file {␊ <!-- markdownlint-configure-file {␊
"heading-style": false,␊ "heading-style": false,␊
@ -38011,16 +38093,34 @@ Generated by [AVA](https://avajs.dev).
], ],
}, },
{ {
errorContext: '### Heading 3b...1} {MD022} ###', errorContext: '### Heading 3b {MD003} {MD021...',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
5,
1, 1,
6,
], ],
fixInfo: { fixInfo: {
deleteCount: 44, deleteCount: 1,
editColumn: 1, editColumn: 5,
insertText: '### Heading 3b {MD003} {MD021} {MD022} ###', },
lineNumber: 32,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md021.md',
ruleNames: [
'MD021',
'no-multiple-space-closed-atx',
],
},
{
errorContext: '...b {MD003} {MD021} {MD022} ###',
errorDetail: null,
errorRange: [
41,
1,
],
fixInfo: {
deleteCount: 1,
editColumn: 41,
}, },
lineNumber: 32, lineNumber: 32,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -46848,13 +46948,31 @@ Generated by [AVA](https://avajs.dev).
errorContext: '# F #', errorContext: '# F #',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
3,
1, 1,
4,
], ],
fixInfo: { fixInfo: {
deleteCount: 7, deleteCount: 1,
editColumn: 1, editColumn: 3,
insertText: '# F #', },
lineNumber: 21,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md021.md',
ruleNames: [
'MD021',
'no-multiple-space-closed-atx',
],
},
{
errorContext: '# F #',
errorDetail: null,
errorRange: [
6,
1,
],
fixInfo: {
deleteCount: 1,
editColumn: 6,
}, },
lineNumber: 21, lineNumber: 21,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -46868,13 +46986,31 @@ Generated by [AVA](https://avajs.dev).
errorContext: '## L ##', errorContext: '## L ##',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
4,
1, 1,
5,
], ],
fixInfo: { fixInfo: {
deleteCount: 9, deleteCount: 1,
editColumn: 1, editColumn: 4,
insertText: '## L ##', },
lineNumber: 41,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md021.md',
ruleNames: [
'MD021',
'no-multiple-space-closed-atx',
],
},
{
errorContext: '## L ##',
errorDetail: null,
errorRange: [
7,
1,
],
fixInfo: {
deleteCount: 1,
editColumn: 7,
}, },
lineNumber: 41, lineNumber: 41,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -46888,13 +47024,31 @@ Generated by [AVA](https://avajs.dev).
errorContext: '# RR #', errorContext: '# RR #',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
3,
1, 1,
4,
], ],
fixInfo: { fixInfo: {
deleteCount: 8, deleteCount: 1,
editColumn: 1, editColumn: 3,
insertText: '# RR #', },
lineNumber: 61,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md021.md',
ruleNames: [
'MD021',
'no-multiple-space-closed-atx',
],
},
{
errorContext: '# RR #',
errorDetail: null,
errorRange: [
7,
1,
],
fixInfo: {
deleteCount: 1,
editColumn: 7,
}, },
lineNumber: 61, lineNumber: 61,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
@ -46908,13 +47062,31 @@ Generated by [AVA](https://avajs.dev).
errorContext: '## XX ##', errorContext: '## XX ##',
errorDetail: null, errorDetail: null,
errorRange: [ errorRange: [
4,
1, 1,
5,
], ],
fixInfo: { fixInfo: {
deleteCount: 10, deleteCount: 1,
editColumn: 1, editColumn: 4,
insertText: '## XX ##', },
lineNumber: 81,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md021.md',
ruleNames: [
'MD021',
'no-multiple-space-closed-atx',
],
},
{
errorContext: '## XX ##',
errorDetail: null,
errorRange: [
8,
1,
],
fixInfo: {
deleteCount: 1,
editColumn: 8,
}, },
lineNumber: 81, lineNumber: 81,
ruleDescription: 'Multiple spaces inside hashes on closed atx style heading', ruleDescription: 'Multiple spaces inside hashes on closed atx style heading',