MD058 - blanks-around-tables¶
Description¶
This rule enforces blank lines around tables. It triggers when tables are not preceded or followed by a blank line. The first table in a document does not require a blank line above, and the last table at the end of a document does not require a blank line below.
Lines holding only blockquote markers (>) or HTML comments count as blank, so tables inside blockquotes and tables directly below a directive comment are accepted. A table that opens a list item whose marker sits alone on the line above needs no blank line above it, because a blank line there would end the list item.
Fixable: Yes
Rationale¶
In addition to aesthetic reasons, some parsers will incorrectly parse tables that don't have blank lines before and after them. Consistent spacing around tables improves readability and ensures proper parsing across different Markdown implementations.
Examples¶
Invalid¶
Some text here.
| Header | Header |
| ------ | ------ |
| Cell | Cell |
> Blockquote
Valid¶
Some text here.
| Header | Header |
| ------ | ------ |
| Cell | Cell |
More text here.