useConsistentHeadingLevel (Markdown)
Language Markdown
Summary
Section titled “Summary”- Rule available since:
v2.5.8 - Diagnostic Category:
lint/nursery/useConsistentHeadingLevel - This rule doesn’t have a fix.
- The default severity of this rule is information.
- Sources:
- Same as
heading-increment
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useConsistentHeadingLevel": "error" } } }}Description
Section titled “Description”Enforce that all heading levels are consistent and ordered.
In a Markdown document, the level of the headings should be consistent and grow only by one level at a time.
This rule catches cases where a heading skips one or more levels.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”# Header 1
### Header 3code-block.md:3:1 lint/nursery/useConsistentHeadingLevel FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ This heading skipped a level.
1 │ # Header 1
2 │
> 3 │ ### Header 3
│ ^^^^^^^^^^^^
4 │
ℹ The previous heading has level1.
> 1 │ # Header 1
│ ^^^^^^^^^^
2 │
3 │ ### Header 3
ℹ headings should follow a consistent level order. Failing to do so could cause issues when the file is transformed into HTML.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
ℹ Safe fix: Change the level of the heading.
3 │ ###·Header·3
│ -
# Header 1
## Header 2Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.