MD007 - ul-indent¶
Description¶
This rule enforces consistent indentation for nested unordered list items. It triggers when list items are not indented by the configured number of spaces (default: 2). This rule only applies to a sublist whose parent lists are all also unordered.
Fixable: Yes
Rationale¶
Consistent indentation improves readability and ensures Markdown documents render correctly across different parsers. Inconsistent indentation can cause compatibility issues, as some parsers require specific indent amounts.
Configuration¶
indent-
Number of spaces for each indentation level.
- Default:
2
- Default:
start_indented-
Whether top-level lists can be indented.
- Default:
false
- Default:
start_indent-
Number of spaces for first-level indentation when start_indented is True. Defaults to the value of indent.
- Default:
none
- Default:
Examples¶
Invalid¶
# Invalid Unordered List Indentation
- Item 1
- Nested item (3 spaces instead of 2)
- Item 2
- Nested with 4 spaces instead of 2
Valid¶
# Valid Unordered List Indentation
- Item 1
- Nested item (2 spaces)
- Another nested item
- Deep nested item (4 spaces total)
- Another deep item
- Item 2
- Nested under 2