markdown-preferences/ordered-list-marker-sequence
enforce that ordered list markers use sequential numbers
- ⚙️ This rule is included in
plugin.configs.standard
. - 🔧 The
--fix
option on the command line can automatically fix some of the problems reported by this rule. - 💡 Some problems reported by this rule are manually fixable by editor suggestions.
📖 Rule Details
This rule enforces that ordered list markers in Markdown use strictly sequential numbers. If the numbering skips, decreases, or starts with an unexpected value, this rule will report an error. The rule can automatically format and correct list numbers to ensure consistency throughout your document.
Key features:
- Ensures that ordered list markers always increase by one, regardless of how many lists are present in a document.
- Handles lists that are separated by paragraphs or other block elements, so numbering can continue across disconnected lists if appropriate.
- Prevents accidental mistakes such as duplicate, skipped, or reversed numbers, which can reduce readability and cause confusion in rendered Markdown.
This rule is especially useful when:
- Multiple people are editing Markdown documents and list numbering errors are likely to occur.
- You want to enforce strict consistency and clarity in documentation or code review processes.
- Some Markdown parsers or tools may render lists incorrectly if the numbering is not sequential.
By enforcing sequential numbering, this rule helps maintain high-quality, easy-to-read Markdown documents and prevents subtle formatting issues.
md
<!-- eslint markdown-preferences/ordered-list-marker-sequence: 'error' -->
## Basic Example
<!-- ✓ GOOD -->
1. foo
2. bar
3. baz
<!-- ✗ BAD -->
1. foo
3. bar
4. baz
<!-- ✗ BAD -->
3. foo
2. bar
1. baz
## Example of Disconnected Lists
<!-- ✓ GOOD -->
1. foo
2. bar
3. baz
paragraph
4. qux
5. quux
<!-- ✗ BAD -->
1. foo
3. bar
4. baz
paragraph
5. qux
7. quux
## Example of Nested Lists
<!-- ✓ GOOD -->
1. foo
2. bar
1. nested
2. nested2
3. baz
<!-- ✗ BAD -->
1. foo
2. bar
1. nested
3. nested2
3. baz
🔧 Options
This rule has no options.
📚 Further Reading
👫 Related Rules
🚀 Version
This rule was introduced in eslint-plugin-markdown-preferences v0.12.0