mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-29 03:58:48 +01:00
Update MD030/list-marker-space to allow bare list item markers for templating scenarios (fixes #235).
This commit is contained in:
parent
6f3c67f760
commit
5ae5e448b0
5 changed files with 66 additions and 43 deletions
36
lib/md030.js
36
lib/md030.js
|
|
@ -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
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue