mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update MD006/ul-start-left to report/fix for all top-level items in lists that start indented.
This commit is contained in:
parent
e717608cac
commit
3981bc7897
4 changed files with 42 additions and 15 deletions
26
lib/md006.js
26
lib/md006.js
|
|
@ -14,18 +14,20 @@ module.exports = {
|
||||||
"function": function MD006(params, onError) {
|
"function": function MD006(params, onError) {
|
||||||
flattenedLists().forEach((list) => {
|
flattenedLists().forEach((list) => {
|
||||||
if (list.unordered && !list.nesting && (list.indent !== 0)) {
|
if (list.unordered && !list.nesting && (list.indent !== 0)) {
|
||||||
const { lineNumber, line } = list.open;
|
list.items.forEach((item) => {
|
||||||
addErrorDetailIf(
|
const { lineNumber, line } = item;
|
||||||
onError,
|
addErrorDetailIf(
|
||||||
lineNumber,
|
onError,
|
||||||
0,
|
lineNumber,
|
||||||
list.indent,
|
0,
|
||||||
null,
|
list.indent,
|
||||||
null,
|
null,
|
||||||
rangeFromRegExp(line, listItemMarkerRe),
|
null,
|
||||||
{
|
rangeFromRegExp(line, listItemMarkerRe),
|
||||||
"deleteCount": line.length - line.trimLeft().length
|
{
|
||||||
});
|
"deleteCount": line.length - line.trimLeft().length
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# Bulleted List Not at Beginning of Line
|
||||||
|
|
||||||
Some text
|
Some text
|
||||||
|
|
||||||
* Item {MD006}
|
* Item {MD006}
|
||||||
|
|
@ -5,10 +7,24 @@ Some text
|
||||||
* Item
|
* Item
|
||||||
* Item
|
* Item
|
||||||
* Item
|
* Item
|
||||||
* Item
|
* Item {MD006}
|
||||||
* Item
|
* Item {MD006}
|
||||||
|
|
||||||
Some more text
|
Some more text
|
||||||
|
|
||||||
* Item {MD006}
|
* Item {MD006}
|
||||||
* Item
|
* Item
|
||||||
|
|
||||||
|
Text
|
||||||
|
|
||||||
|
* Item {MD006} {MD007}
|
||||||
|
* Item {MD006}
|
||||||
|
* Item {MD006}
|
||||||
|
|
||||||
|
Text
|
||||||
|
|
||||||
|
* Item {MD006}
|
||||||
|
|
||||||
|
* Item {MD006}
|
||||||
|
|
||||||
|
* Item {MD006}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
- Charlie
|
- Charlie
|
||||||
|
|
||||||
* Delta
|
* Delta
|
||||||
* Echo
|
* Echo
|
||||||
|
|
||||||
Text
|
Text
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,15 @@
|
||||||
"errorContext": null,
|
"errorContext": null,
|
||||||
"errorRange": [1, 3]
|
"errorRange": [1, 3]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"lineNumber": 13,
|
||||||
|
"ruleNames": [ "MD006", "ul-start-left" ],
|
||||||
|
"ruleDescription": "Consider starting bulleted lists at the beginning of the line",
|
||||||
|
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md006",
|
||||||
|
"errorDetail": "Expected: 0; Actual: 1",
|
||||||
|
"errorContext": null,
|
||||||
|
"errorRange": [1, 3]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"lineNumber": 12,
|
"lineNumber": 12,
|
||||||
"ruleNames": [ "MD007", "ul-indent" ],
|
"ruleNames": [ "MD007", "ul-indent" ],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue