MD029 - ol-prefix¶
Description¶
This rule ensures that ordered list item prefixes follow a consistent pattern. The style setting controls which numbering pattern is enforced: one requires all items use '1.', ordered requires sequential numbering starting from 0 or 1, zero requires all items use '0.', and one_or_ordered (default) accepts either the 'one' or 'ordered' patterns, auto-detecting which is in use from the first two items.
A list may start at another number, for example to continue an earlier list after a paragraph. Its first item is still reported, but the fix leaves it alone because it sets the number the rendered list starts at, and the items after it are expected to count up from it.
Prefixes may be zero-padded or space-padded so that list item content lines up (for example 08./09./10. or 8./9./10.). Fixes preserve that alignment.
Fixable: Yes
Rationale¶
Consistent formatting makes it easier to understand a document. Using '1.' for all items simplifies reordering since items can be moved without renumbering, while sequential numbering provides explicit ordering at a glance.
Configuration¶
style-
Required ordered list prefix style.
- Default:
one_or_ordered - Options:
one: All list items must use '1.' as the prefixordered: List items must use sequential numbering starting from 0 or 1 (e.g. 1, 2, 3 or 0, 1, 2)one_or_ordered: Either 'one' or 'ordered' style is acceptable (auto-detected)zero: All list items must use '0.' as the prefix
- Default:
Examples¶
Invalid¶
# Ordered List with Inconsistent Prefixes
1. First item
3. Second item
2. Third item
Valid¶
# Ordered List with Consistent Prefixes
1. First item
1. Second item
1. Third item