2022-10-30 15:13:19 -07:00
|
|
|
# ~~`MD002` - First heading should be a top-level heading~~
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
> This rule is deprecated and provided for backward-compatibility
|
|
|
|
|
2022-10-30 15:13:19 -07:00
|
|
|
Tags: `headers`, `headings`
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-10-30 15:13:19 -07:00
|
|
|
Aliases: `first-header-h1`, `first-heading-h1`
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
2022-11-13 20:53:10 -08:00
|
|
|
- `level`: Heading level (`integer`, default `1`)
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
> Note: *MD002 has been deprecated and is disabled by default.*
|
|
|
|
> [MD041/first-line-heading](md041.md) offers an improved implementation.
|
|
|
|
|
|
|
|
This rule is intended to ensure document headings start at the top level and
|
|
|
|
is triggered when the first heading in the document isn't an h1 heading:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
## This isn't an H1 heading
|
|
|
|
|
|
|
|
### Another heading
|
|
|
|
```
|
|
|
|
|
|
|
|
The first heading in the document should be an h1 heading:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
# Start with an H1 heading
|
|
|
|
|
|
|
|
## Then use an H2 for subsections
|
|
|
|
```
|
|
|
|
|
|
|
|
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
|
|
|
|
cases where an h1 is added externally.
|
|
|
|
|
|
|
|
Rationale: The top-level heading often acts as the title of a document. More
|
|
|
|
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
|