2022-10-29 23:21:45 -07:00
|
|
|
This rule is triggered when headings (any style) are either not preceded or not
|
|
|
|
followed by at least one blank line:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
# Heading 1
|
|
|
|
Some text
|
|
|
|
|
|
|
|
Some more text
|
|
|
|
## Heading 2
|
|
|
|
```
|
|
|
|
|
|
|
|
To fix this, ensure that all headings have a blank line both before and after
|
|
|
|
(except where the heading is at the beginning or end of the document):
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
# Heading 1
|
|
|
|
|
|
|
|
Some text
|
|
|
|
|
|
|
|
Some more text
|
|
|
|
|
|
|
|
## Heading 2
|
|
|
|
```
|
|
|
|
|
2022-11-05 17:34:37 -07:00
|
|
|
The `lines_above` and `lines_below` parameters can be used to specify a
|
2023-08-08 22:56:47 -07:00
|
|
|
different number of blank lines (including `0`) above or below each heading.
|
|
|
|
If the value `-1` is used for either parameter, any number of blank lines is
|
|
|
|
allowed. To customize the number of lines above or below each heading level
|
|
|
|
individually, specify a `number[]` where values correspond to heading levels
|
|
|
|
1-6 (in order).
|
|
|
|
|
|
|
|
Notes: If `lines_above` or `lines_below` are configured to require more than one
|
|
|
|
blank line, [MD012/no-multiple-blanks](md012.md) should also be customized. This
|
|
|
|
rule checks for *at least* as many blank lines as specified; any extra blank
|
|
|
|
lines are ignored.
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-11-05 17:34:37 -07:00
|
|
|
Rationale: Aside from aesthetic reasons, some parsers, including `kramdown`,
|
|
|
|
will not parse headings that don't have a blank line before, and will parse them
|
|
|
|
as regular text.
|