Update MD030/list-marker-space to allow bare list item markers for templating scenarios (fixes #235).

This commit is contained in:
David Anson 2019-12-10 22:09:40 -08:00
parent 6f3c67f760
commit 5ae5e448b0
5 changed files with 66 additions and 43 deletions

View file

@ -24,24 +24,26 @@ module.exports = {
const { line, lineNumber } = item;
const match = /^[\s>]*\S+(\s*)/.exec(line);
const [ { "length": matchLength }, { "length": actualSpaces } ] = match;
let fixInfo = null;
if ((expectedSpaces !== actualSpaces) && (line.length > matchLength)) {
fixInfo = {
"editColumn": matchLength - actualSpaces + 1,
"deleteCount": actualSpaces,
"insertText": "".padEnd(expectedSpaces)
};
if (matchLength < line.length) {
let fixInfo = null;
if (expectedSpaces !== actualSpaces) {
fixInfo = {
"editColumn": matchLength - actualSpaces + 1,
"deleteCount": actualSpaces,
"insertText": "".padEnd(expectedSpaces)
};
}
addErrorDetailIf(
onError,
lineNumber,
expectedSpaces,
actualSpaces,
null,
null,
[ 1, matchLength ],
fixInfo
);
}
addErrorDetailIf(
onError,
lineNumber,
expectedSpaces,
actualSpaces,
null,
null,
[ 1, matchLength ],
fixInfo
);
});
});
}