mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-01-15 04:18:51 +01:00
36 lines
No EOL
756 B
Markdown
36 lines
No EOL
756 B
Markdown
# MD031 - Fenced code blocks should be surrounded by blank lines
|
|
|
|
Tags: code, blank_lines
|
|
|
|
Aliases: blanks-around-fences
|
|
|
|
This rule is triggered when fenced code blocks are either not preceded or not
|
|
followed by a blank line:
|
|
|
|
Some text
|
|
```
|
|
Code block
|
|
```
|
|
|
|
```
|
|
Another code block
|
|
```
|
|
Some more text
|
|
|
|
To fix this, ensure that all fenced code blocks have a blank line both before
|
|
and after (except where the block is at the beginning or end of the document):
|
|
|
|
Some text
|
|
|
|
```
|
|
Code block
|
|
```
|
|
|
|
```
|
|
Another code block
|
|
```
|
|
|
|
Some more text
|
|
|
|
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. |