Allow for first level indentation of lists in MD007/ul-indent (fixes #242).

This commit is contained in:
Jeremy Thomerson 2020-01-01 15:53:03 -05:00 committed by David Anson
parent 5634b317d6
commit 9aeddedb7d
7 changed files with 81 additions and 3 deletions

View file

@ -11,12 +11,14 @@ module.exports = {
"description": "Unordered list indentation",
"tags": [ "bullet", "ul", "indentation" ],
"function": function MD007(params, onError) {
const optionsIndent = params.config.indent || 2;
const indent = params.config.indent || 2;
const startIndented = !!params.config.start_indented;
flattenedLists().forEach((list) => {
if (list.unordered && list.parentsUnordered) {
list.items.forEach((item) => {
const { lineNumber, line } = item;
const expectedIndent = list.nesting * optionsIndent;
const expectedNesting = list.nesting + (startIndented ? 1 : 0);
const expectedIndent = expectedNesting * indent;
const actualIndent = indentFor(item);
let range = null;
let editColumn = 1;