Skip to content

Latest commit

 

History

History
70 lines (44 loc) · 1.83 KB

File metadata and controls

70 lines (44 loc) · 1.83 KB

MD007 - Unordered list indentation

Tags

bullet, indentation, ul

Aliases

ul-indent

Parameters

  • indent: Spaces for indent (integer, default 2)
  • start_indent: Spaces for first level indent when start_indented is set (integer, default 2)
  • start_indented: Whether to indent the first level of the list (boolean, default false)

Fixable

Some violations can be fixed by tooling

Description

This rule is triggered when list items are not indented by the configured number of spaces (default: 2).

Problematic

* List item
 * Nested list item indented by 1 space

Correct

* List item
  * Nested list item indented by 2 spaces

Rationale

Indenting by 2 spaces allows the content of a nested list to be in line with the start of the content of the parent list when a single space is used after the list marker. Indenting by 4 spaces is consistent with code blocks and simpler for editors to implement.

Configuration

The indent parameter specifies how many spaces to use for each level of nesting (default: 2).

The start_indented parameter controls whether the first level of the list should be indented (default: false).

The start_indent parameter specifies how many spaces to use for the first level when start_indented is true (default: 2).

Example with indent: 4

* Top level
    * Second level (4 spaces)
        * Third level (8 spaces)

Example with start_indented: true, start_indent: 2

  * First level indented by 2
    * Second level indented by 4 (start_indent + indent)

Notes

  • This rule applies to unordered sublists only if all parent lists are also unordered
  • Mixed ordered and unordered lists (unordered nested in ordered) are ignored
  • The rule checks indentation based on the tree structure, not visual alignment