fix(md012): do not flag blank lines adjacent to headings (fixes #990).

Blank lines immediately above or below a heading are now excluded from
MD012's consecutive-blank-line count. Those blank lines are governed by
MD022 (blanks-around-headings), so MD012 defers to it. This means users
can set MD022's lines_above/lines_below > 1 without triggering spurious
MD012 violations.
This commit is contained in:
Ruben J. Jongejan 2026-02-21 13:05:05 +01:00
parent 0213a0274d
commit ccd26cef7f
No known key found for this signature in database
7 changed files with 106 additions and 4 deletions

View file

@ -470,6 +470,10 @@ Some more text here
Note: this rule will not be triggered if there are multiple consecutive blank
lines inside code blocks.
Note: Blank lines immediately adjacent to headings are not flagged by this
rule; the number of blank lines around headings is governed by
`MD022`/`blanks-around-headings`.
Note: The `maximum` parameter can be used to configure the maximum number of
consecutive blank lines.

View file

@ -31,6 +31,10 @@ Some more text here
Note: this rule will not be triggered if there are multiple consecutive blank
lines inside code blocks.
Note: Blank lines immediately adjacent to headings are not flagged by this
rule; the number of blank lines around headings is governed by
`MD022`/`blanks-around-headings`.
Note: The `maximum` parameter can be used to configure the maximum number of
consecutive blank lines.