[GH-ISSUE #503] suggestion; allow 2 consecutive blank lines in front of headings #2259

Closed
opened 2026-03-07 20:06:04 +03:00 by kerem · 4 comments
Owner

Originally created by @Reissner on GitHub (Feb 23, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/503

Maybe a good idea to make configurable:
allow 2 blank lines in front of headings.
In this case, the 2 blank lines serve a goal: improve readability.

Originally created by @Reissner on GitHub (Feb 23, 2022). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/503 Maybe a good idea to make configurable: allow 2 blank lines in front of headings. In this case, the 2 blank lines serve a goal: improve readability.
kerem 2026-03-07 20:06:04 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Feb 23, 2022):

MD022 supports a lines_above which should do what you want.

https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md022

<!-- gh-comment-id:1049273555 --> @DavidAnson commented on GitHub (Feb 23, 2022): MD022 supports a `lines_above` which should do what you want. https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md022
Author
Owner

@TheJaredWilcurt commented on GitHub (Feb 25, 2022):

@Reissner Example from my ruleset:

# MD022 - Headings should be surrounded by blank lines
blanks-around-headings:
  lines_above: 2
  lines_below: 1
<!-- gh-comment-id:1050903897 --> @TheJaredWilcurt commented on GitHub (Feb 25, 2022): @Reissner Example from my ruleset: * https://github.com/tjw-lint/tjw-markdownlint-rules/blob/main/tjwmarkdownlint.yml#L59-L62 ```yml # MD022 - Headings should be surrounded by blank lines blanks-around-headings: lines_above: 2 lines_below: 1 ```
Author
Owner

@lud commented on GitHub (Feb 25, 2022):

Generally my manual formatting goes this way:

  • two blank lines above h2
  • one blank line above h3 or lower
  • one blank line below all headings

Thanks to that the visual separation of the mains sections of the text is more obvious.

Is that something that markdownlint could enforce or do you think it is too specific?

<!-- gh-comment-id:1051023344 --> @lud commented on GitHub (Feb 25, 2022): Generally my manual formatting goes this way: * two blank lines above `h2` * one blank line above `h3` or lower * one blank line below all headings Thanks to that the visual separation of the mains sections of the text is more obvious. Is that something that markdownlint could enforce or do you think it is too specific?
Author
Owner

@DavidAnson commented on GitHub (Feb 25, 2022):

That's pretty specialized, but I could imagine adding a property to the existing rule that let you set the number of lines above and below each heading level. That would allow you to require the behavior you want - as well as anything else. I'd want to track this request as a new "enhancement" issue, rather than with this one, so please open it if you'd like.

<!-- gh-comment-id:1051109028 --> @DavidAnson commented on GitHub (Feb 25, 2022): That's pretty specialized, but I could imagine adding a property to the existing rule that let you set the number of lines above and below each heading level. That would allow you to require the behavior you want - as well as anything else. I'd want to track this request as a new "enhancement" issue, rather than with this one, so please open it if you'd like.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#2259
No description provided.