Skip to content

useTopLevelHeading (Markdown)

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

Require Markdown documents to start with a top-level heading.

Requires the first block in the document to be a level-1 heading, either ATX (# Heading) or setext (Heading followed by ===).

Leading HTML comments used as file preamble are ignored when determining the first block.

The rule does not report when the first block is an HTML block or a thematic break. HTML blocks are permitted because some projects use HTML markup for their heading, especially in READMEs.

Some text
# Heading
code-block.md:1:1 lint/nursery/useTopLevelHeading ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Missing top-level heading.

> 1 │ Some text
│ ^^^^^^^^^
> 2 │
│
3 │ # Heading
4 │

ℹ The document should start with a top-level heading (h1) so readers and tools can identify its title. Add a # Heading (or a level-1 setext heading) at the start of the document.

ℹ 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.

# Heading
Some text
---
title: Example
---
## Section
<div>Intro</div>
## Section