2018-01-21 21:44:25 -08:00
|
|
|
// @ts-check
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2018-04-27 22:05:34 -07:00
|
|
|
const shared = require("./shared");
|
2018-01-21 21:44:25 -08:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
"names": [ "MD007", "ul-indent" ],
|
|
|
|
"description": "Unordered list indentation",
|
|
|
|
"tags": [ "bullet", "ul", "indentation" ],
|
|
|
|
"function": function MD007(params, onError) {
|
2018-04-27 22:05:34 -07:00
|
|
|
const optionsIndent = params.config.indent || 2;
|
2018-03-04 23:06:31 -08:00
|
|
|
shared.flattenLists().forEach(function forList(list) {
|
2018-03-05 20:56:12 -08:00
|
|
|
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));
|
2018-01-21 21:44:25 -08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|