mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 22:40:13 +01:00
Move each rule implementation into its own file (fixes #83).
This commit is contained in:
parent
49e36f817c
commit
9ba143555d
42 changed files with 1289 additions and 1028 deletions
26
lib/md007.js
Normal file
26
lib/md007.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
var shared = require("./shared");
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD007", "ul-indent" ],
|
||||
"description": "Unordered list indentation",
|
||||
"tags": [ "bullet", "ul", "indentation" ],
|
||||
"function": function MD007(params, onError) {
|
||||
var optionsIndent = params.config.indent || 2;
|
||||
var prevIndent = 0;
|
||||
shared.flattenLists(params).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;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue