mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Update MD022/blanks-around-headings to allow specifying a different number of blank lines for each heading level (fixes #504).
This commit is contained in:
parent
bdc9d357f3
commit
d9de1dd22f
13 changed files with 690 additions and 64 deletions
|
@ -68,9 +68,10 @@ for (const rule of rules) {
|
|||
);
|
||||
for (const property of Object.keys(ruleData.properties).sort()) {
|
||||
const propData = ruleData.properties[property];
|
||||
const propType = (propData.type === "array") ?
|
||||
`${propData.items.type}[]` :
|
||||
propData.type;
|
||||
const propType = [ propData.type ]
|
||||
.flat()
|
||||
.map((type) => ((type === "array") ? `${propData.items.type}[]` : type))
|
||||
.join("|");
|
||||
const defaultValue = Array.isArray(propData.default) ?
|
||||
JSON.stringify(propData.default) :
|
||||
propData.default;
|
||||
|
|
|
@ -23,12 +23,16 @@ Some more text
|
|||
```
|
||||
|
||||
The `lines_above` and `lines_below` parameters can be used to specify a
|
||||
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.
|
||||
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).
|
||||
|
||||
Note: 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.
|
||||
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.
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue