mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Fix MD007/ul-indent to use parent indent instead of previous indent (fixes #106).
This commit is contained in:
parent
748c8cac17
commit
40ace5bb5e
6 changed files with 58 additions and 15 deletions
13
lib/md007.js
13
lib/md007.js
|
@ -10,16 +10,11 @@ module.exports = {
|
|||
"tags": [ "bullet", "ul", "indentation" ],
|
||||
"function": function MD007(params, onError) {
|
||||
var optionsIndent = params.config.indent || 2;
|
||||
var prevIndent = 0;
|
||||
shared.flattenLists().forEach(function forList(list) {
|
||||
if (list.unordered && list.parentsUnordered) {
|
||||
var indent = shared.indentFor(list.open);
|
||||
if (indent > prevIndent) {
|
||||
shared.addErrorDetailIf(onError, list.open.lineNumber,
|
||||
prevIndent + optionsIndent, indent, null,
|
||||
shared.rangeFromRegExp(list.open.line, shared.listItemMarkerRe));
|
||||
}
|
||||
prevIndent = indent;
|
||||
if (list.unordered && list.parentsUnordered && list.indent) {
|
||||
shared.addErrorDetailIf(onError, list.open.lineNumber,
|
||||
list.parentIndent + optionsIndent, list.indent, null,
|
||||
shared.rangeFromRegExp(list.open.line, shared.listItemMarkerRe));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue