mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-21 21:30:47 +02: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
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,10 +1,33 @@
|
|||
*
|
||||
# Bare List Markers
|
||||
|
||||
+
|
||||
|
||||
-
|
||||
## Ordered 1/1/1
|
||||
|
||||
1.
|
||||
1.
|
||||
1.
|
||||
|
||||
{MD004:3}{MD004:5}
|
||||
{MD030:1}{MD030:3}{MD030:5}{MD030:7}
|
||||
## Ordered 1/2/3
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
## Unordered *
|
||||
|
||||
*
|
||||
*
|
||||
*
|
||||
|
||||
## Unordered +
|
||||
|
||||
+
|
||||
+
|
||||
+
|
||||
|
||||
## Unordered -
|
||||
|
||||
-
|
||||
-
|
||||
-
|
||||
|
||||
<!-- markdownlint-disable-file ul-style -->
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
#
|
||||
|
||||
-
|
||||
(bare list item marker)
|
||||
|
||||
1.
|
||||
(bare list item marker)
|
||||
|
||||
-a
|
||||
(not a list item)
|
||||
|
||||
1.a
|
||||
(not a list item)
|
||||
|
||||
- a
|
||||
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
#
|
||||
|
||||
-
|
||||
(bare list item marker)
|
||||
|
||||
1.
|
||||
(bare list item marker)
|
||||
|
||||
-a
|
||||
(not a list item)
|
||||
|
||||
1.a
|
||||
(not a list item)
|
||||
|
||||
- a
|
||||
|
||||
|
|
|
@ -1,24 +1,6 @@
|
|||
[
|
||||
{
|
||||
"lineNumber": 3,
|
||||
"ruleNames": [ "MD030", "list-marker-space" ],
|
||||
"ruleDescription": "Spaces after list markers",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030",
|
||||
"errorDetail": "Expected: 1; Actual: 0",
|
||||
"errorContext": null,
|
||||
"errorRange": [1, 1]
|
||||
},
|
||||
{
|
||||
"lineNumber": 5,
|
||||
"ruleNames": [ "MD030", "list-marker-space" ],
|
||||
"ruleDescription": "Spaces after list markers",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030",
|
||||
"errorDetail": "Expected: 1; Actual: 0",
|
||||
"errorContext": null,
|
||||
"errorRange": [1, 2]
|
||||
},
|
||||
{
|
||||
"lineNumber": 11,
|
||||
"lineNumber": 19,
|
||||
"ruleNames": [ "MD030", "list-marker-space" ],
|
||||
"ruleDescription": "Spaces after list markers",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030",
|
||||
|
@ -27,7 +9,7 @@
|
|||
"errorRange": [1, 3]
|
||||
},
|
||||
{
|
||||
"lineNumber": 13,
|
||||
"lineNumber": 21,
|
||||
"ruleNames": [ "MD030", "list-marker-space" ],
|
||||
"ruleDescription": "Spaces after list markers",
|
||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue