Update MD007/ul-indent to support start_indent parameter (fixes #337, closes #397).

This commit is contained in:
David Anson 2021-12-13 21:49:43 -08:00
parent 13e375b281
commit 517eb42015
12 changed files with 151 additions and 7 deletions

View file

@ -13,12 +13,14 @@ module.exports = {
"function": function MD007(params, onError) {
const indent = Number(params.config.indent || 2);
const startIndented = !!params.config.start_indented;
const startIndent = Number(params.config.start_indent || indent);
flattenedLists().forEach((list) => {
if (list.unordered && list.parentsUnordered) {
list.items.forEach((item) => {
const { lineNumber, line } = item;
const expectedNesting = list.nesting + (startIndented ? 1 : 0);
const expectedIndent = expectedNesting * indent;
const expectedIndent =
(startIndented ? startIndent : 0) +
(list.nesting * indent);
const actualIndent = indentFor(item);
let range = null;
let editColumn = 1;