2022-10-30 15:13:19 -07:00
|
|
|
# `MD007` - Unordered list indentation
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-10-30 15:13:19 -07:00
|
|
|
Tags: `bullet`, `indentation`, `ul`
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-10-30 15:13:19 -07:00
|
|
|
Aliases: `ul-indent`
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
2022-11-13 20:53:10 -08:00
|
|
|
- `indent`: Spaces for indent (`integer`, default `2`)
|
|
|
|
- `start_indent`: Spaces for first level indent (when start_indented is set)
|
2022-11-05 17:34:37 -07:00
|
|
|
(`integer`, default `2`)
|
2022-11-13 20:53:10 -08:00
|
|
|
- `start_indented`: Whether to indent the first level of the list (`boolean`,
|
2022-11-05 17:34:37 -07:00
|
|
|
default `false`)
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-12-16 13:53:03 -08:00
|
|
|
Fixable: Some violations can be fixed by tooling
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
This rule is triggered when list items are not indented by the configured
|
|
|
|
number of spaces (default: 2).
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
* List item
|
|
|
|
* Nested list item indented by 3 spaces
|
|
|
|
```
|
|
|
|
|
|
|
|
Corrected Example:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
* List item
|
|
|
|
* Nested list item indented by 2 spaces
|
|
|
|
```
|
|
|
|
|
|
|
|
Note: This rule applies to a sublist only if its parent lists are all also
|
|
|
|
unordered (otherwise, extra indentation of ordered lists interferes with the
|
|
|
|
rule).
|
|
|
|
|
|
|
|
The `start_indented` parameter allows the first level of lists to be indented by
|
2023-11-09 19:47:15 -08:00
|
|
|
the configured number of spaces rather than starting at zero. The `start_indent`
|
|
|
|
parameter allows the first level of lists to be indented by a different number
|
|
|
|
of spaces than the rest (ignored when `start_indented` is not set).
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
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. Additionally, this can be a compatibility
|
2022-11-05 17:34:37 -07:00
|
|
|
issue for other Markdown parsers, which require 4-space indents. More
|
2023-09-10 20:21:51 -07:00
|
|
|
information: [Markdown Style Guide][markdown-style-guide].
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
Note: See [Prettier.md](Prettier.md) for compatibility information.
|
2022-11-05 17:34:37 -07:00
|
|
|
|
|
|
|
[markdown-style-guide]: https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists
|