mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +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
|
|
@ -24,8 +24,9 @@ module.exports = {
|
||||||
const { line, lineNumber } = item;
|
const { line, lineNumber } = item;
|
||||||
const match = /^[\s>]*\S+(\s*)/.exec(line);
|
const match = /^[\s>]*\S+(\s*)/.exec(line);
|
||||||
const [ { "length": matchLength }, { "length": actualSpaces } ] = match;
|
const [ { "length": matchLength }, { "length": actualSpaces } ] = match;
|
||||||
|
if (matchLength < line.length) {
|
||||||
let fixInfo = null;
|
let fixInfo = null;
|
||||||
if ((expectedSpaces !== actualSpaces) && (line.length > matchLength)) {
|
if (expectedSpaces !== actualSpaces) {
|
||||||
fixInfo = {
|
fixInfo = {
|
||||||
"editColumn": matchLength - actualSpaces + 1,
|
"editColumn": matchLength - actualSpaces + 1,
|
||||||
"deleteCount": actualSpaces,
|
"deleteCount": actualSpaces,
|
||||||
|
|
@ -42,6 +43,7 @@ module.exports = {
|
||||||
[ 1, matchLength ],
|
[ 1, matchLength ],
|
||||||
fixInfo
|
fixInfo
|
||||||
);
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,33 @@
|
||||||
*
|
# Bare List Markers
|
||||||
|
|
||||||
+
|
## Ordered 1/1/1
|
||||||
|
|
||||||
-
|
|
||||||
|
|
||||||
|
1.
|
||||||
|
1.
|
||||||
1.
|
1.
|
||||||
|
|
||||||
{MD004:3}{MD004:5}
|
## Ordered 1/2/3
|
||||||
{MD030:1}{MD030:3}{MD030:5}{MD030:7}
|
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
|
||||||
|
## Unordered *
|
||||||
|
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
|
||||||
|
## Unordered +
|
||||||
|
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
|
||||||
|
## Unordered -
|
||||||
|
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-
|
||||||
|
|
||||||
|
<!-- markdownlint-disable-file ul-style -->
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,16 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
-
|
-
|
||||||
|
(bare list item marker)
|
||||||
|
|
||||||
1.
|
1.
|
||||||
|
(bare list item marker)
|
||||||
|
|
||||||
|
-a
|
||||||
|
(not a list item)
|
||||||
|
|
||||||
|
1.a
|
||||||
|
(not a list item)
|
||||||
|
|
||||||
- a
|
- a
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,16 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
-
|
-
|
||||||
|
(bare list item marker)
|
||||||
|
|
||||||
1.
|
1.
|
||||||
|
(bare list item marker)
|
||||||
|
|
||||||
|
-a
|
||||||
|
(not a list item)
|
||||||
|
|
||||||
|
1.a
|
||||||
|
(not a list item)
|
||||||
|
|
||||||
- a
|
- a
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,6 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"lineNumber": 3,
|
"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",
|
|
||||||
"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,
|
|
||||||
"ruleNames": [ "MD030", "list-marker-space" ],
|
"ruleNames": [ "MD030", "list-marker-space" ],
|
||||||
"ruleDescription": "Spaces after list markers",
|
"ruleDescription": "Spaces after list markers",
|
||||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030",
|
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030",
|
||||||
|
|
@ -27,7 +9,7 @@
|
||||||
"errorRange": [1, 3]
|
"errorRange": [1, 3]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"lineNumber": 13,
|
"lineNumber": 21,
|
||||||
"ruleNames": [ "MD030", "list-marker-space" ],
|
"ruleNames": [ "MD030", "list-marker-space" ],
|
||||||
"ruleDescription": "Spaces after list markers",
|
"ruleDescription": "Spaces after list markers",
|
||||||
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030",
|
"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