Skip to content

useConsistentHeadingLevel (Markdown)

Language Markdown
biome.json
{
"linter": {
"rules": {
"nursery": {
"useConsistentHeadingLevel": "error"
}
}
}
}

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.

# Header 1
### Header 3
code-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 2