useTopLevelHeading (Markdown)
Language Markdown
Summary
Section titled “Summary”- Rule available since:
v2.5.8 - Diagnostic Category:
lint/nursery/useTopLevelHeading - This rule doesn’t have a fix.
- The default severity of this rule is information.
- Sources:
- Same as
first-line-heading
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useTopLevelHeading": "error" } } }}Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”Some text
# Headingcode-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>
## SectionRelated links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.