Skip to content

Latest commit

 

History

History
98 lines (70 loc) · 1.69 KB

md029.md

File metadata and controls

98 lines (70 loc) · 1.69 KB

MD029 - Ordered list item prefix

Tags: ol

Aliases: ol-prefix

Parameters:

  • style: List style (string, default one_or_ordered, values one / one_or_ordered / ordered / zero)

This rule is triggered for ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style). The less-common pattern of using '0.' as a first prefix or for all prefixes is also supported.

Example valid list if the style is configured as 'one':

1. Do this.
1. Do that.
1. Done.

Examples of valid lists if the style is configured as 'ordered':

1. Do this.
2. Do that.
3. Done.
0. Do this.
1. Do that.
2. Done.

All three examples are valid when the style is configured as 'one_or_ordered'.

Example valid list if the style is configured as 'zero':

0. Do this.
0. Do that.
0. Done.

Example invalid list for all styles:

1. Do this.
3. Done.

This rule supports 0-prefixing ordered list items for uniform indentation:

...
08. Item
09. Item
10. Item
11. Item
...

Note: This rule will report violations for cases like the following where an improperly-indented code block (or similar) appears between two list items and "breaks" the list in two:

1. First list

```text
Code block
```

1. Second list

The fix is to indent the code block so it becomes part of the preceding list item as intended:

1. First list

   ```text
   Code block
   ```

2. Still first list

Rationale: Consistent formatting makes it easier to understand a document.