Skip to content

MD005 - list-indent

Description

This rule detects when list items within the same list have inconsistent indentation. Each list is checked independently; separate lists in the same document do not affect each other. Both ordered and unordered lists are checked. For ordered lists, right-aligned markers are accepted (e.g., when items 9 and 10 have different leading spaces but their markers end at the same column).

Rationale

Inconsistent indentation can lead to improperly rendered content. Even small differences in spacing may cause Markdown parsers to interpret list structure differently than intended, resulting in incorrect nesting or broken lists in the final output.

Examples

Invalid

# Inconsistent Indentation

- Item 1
  - Nested with 2 spaces
   - Nested with 3 spaces

Valid

# Consistent Indentation

- Item 1
  - Nested item 1
  - Nested item 2
    - Deep nested 1
    - Deep nested 2
- Item 2
  - Nested under 2