2022-10-30 15:13:19 -07:00
|
|
|
# `MD003` - Heading style
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2023-11-09 20:05:30 -08:00
|
|
|
Tags: `headings`
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2023-11-09 20:05:30 -08:00
|
|
|
Aliases: `heading-style`
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
2022-11-13 20:53:10 -08:00
|
|
|
- `style`: Heading style (`string`, default `consistent`, values `atx` /
|
2022-11-05 17:34:37 -07:00
|
|
|
`atx_closed` / `consistent` / `setext` / `setext_with_atx` /
|
|
|
|
`setext_with_atx_closed`)
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-12-08 22:30:17 -08:00
|
|
|
This rule is triggered when different heading styles are used in the same
|
|
|
|
document:
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
```markdown
|
|
|
|
# ATX style H1
|
|
|
|
|
|
|
|
## Closed ATX style H2 ##
|
|
|
|
|
|
|
|
Setext style H1
|
|
|
|
===============
|
|
|
|
```
|
|
|
|
|
2022-12-08 22:30:17 -08:00
|
|
|
To fix the issue, use consistent heading styles throughout the document:
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
```markdown
|
|
|
|
# ATX style H1
|
|
|
|
|
|
|
|
## ATX style H2
|
|
|
|
```
|
|
|
|
|
2022-12-08 22:30:17 -08:00
|
|
|
The `setext_with_atx` and `setext_with_atx_closed` settings allow ATX-style
|
|
|
|
headings of level 3 or more in documents with setext-style headings (which only
|
|
|
|
support level 1 and 2 headings):
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
```markdown
|
|
|
|
Setext style H1
|
|
|
|
===============
|
|
|
|
|
|
|
|
Setext style H2
|
|
|
|
---------------
|
|
|
|
|
|
|
|
### ATX style H3
|
|
|
|
```
|
|
|
|
|
2022-12-08 22:30:17 -08:00
|
|
|
Note: The configured heading style can be a specific style to require (`atx`,
|
2024-10-07 22:08:16 -07:00
|
|
|
`atx_closed`, `setext`, `setext_with_atx`, `setext_with_atx_closed`), or can
|
|
|
|
require that all heading styles match the first heading style via `consistent`.
|
2022-12-08 22:30:17 -08:00
|
|
|
|
|
|
|
Note: The placement of a horizontal rule directly below a line of text can
|
|
|
|
trigger this rule by turning that text into a level 2 setext-style heading:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
A line of text followed by a horizontal rule becomes a heading
|
|
|
|
---
|
|
|
|
```
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
Rationale: Consistent formatting makes it easier to understand a document.
|