markdownlint icon indicating copy to clipboard operation
markdownlint copied to clipboard

MD031: Make rule configurable with lines above/after like MD022

Open cjcarpen opened this issue 3 years ago • 1 comments

MD031 - Fenced code blocks should be surrounded by blank lines notes in the rationale:

Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse fenced code blocks that don't have blank lines before and after them.

However, we use a Markdown parser with Kramdown-style attributes, which for block-level elements are applied on the line immediately after the block. For example, to apply an ID:

```
this is my code block
```
{: #my-code-block}

Because of this, we'd like to be able to configure MD031 with lines_above and lines_below much like you can for MD022, Headings should be surrounded by blank lines. This would allow us to enable the MD031 rule to enforce an empty line above code blocks while still supporting Kramdown-style attributes on code blocks.

cjcarpen avatar May 20 '22 18:05 cjcarpen

This also affects:

MD058/blanks-around-tables

And FYI, kramdown supports these attributes before or after the content:

{: .lead}
Hi

Try it yourself at:

https://kramdown.electricbook.works/

fulldecent avatar Sep 10 '24 19:09 fulldecent