2018-01-21 21:44:25 -08:00
|
|
|
// @ts-check
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2019-04-10 21:26:59 -07:00
|
|
|
const { addErrorDetailIf, listItemMarkerRe, rangeFromRegExp } =
|
2019-04-13 11:18:57 -07:00
|
|
|
require("../helpers");
|
2019-04-10 21:26:59 -07:00
|
|
|
const { flattenedLists } = require("./cache");
|
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;
|
2019-04-10 21:26:59 -07:00
|
|
|
flattenedLists().forEach((list) => {
|
2018-03-05 20:56:12 -08:00
|
|
|
if (list.unordered && list.parentsUnordered && list.indent) {
|
2019-04-10 21:26:59 -07:00
|
|
|
addErrorDetailIf(onError, list.open.lineNumber,
|
2019-03-24 21:50:56 -07:00
|
|
|
list.parentIndent + optionsIndent, list.indent, null, null,
|
2019-04-10 21:26:59 -07:00
|
|
|
rangeFromRegExp(list.open.line, listItemMarkerRe));
|
2018-01-21 21:44:25 -08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|