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,8 +24,9 @@ module.exports = {
const { line, lineNumber } = item;
const match = /^[\s>]*\S+(\s*)/.exec(line);
const [ { "length": matchLength }, { "length": actualSpaces } ] = match;
if (matchLength < line.length) {
let fixInfo = null;
if ((expectedSpaces !== actualSpaces) && (line.length > matchLength)) {
if (expectedSpaces !== actualSpaces) {
fixInfo = {
"editColumn": matchLength - actualSpaces + 1,
"deleteCount": actualSpaces,
@ -42,6 +43,7 @@ module.exports = {
[ 1, matchLength ],
fixInfo
);
}
});
});
}

View file

@ -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 -->

View file

@ -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

View file

@ -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

View file

@ -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",