Skip to content

Latest commit

 

History

History
83 lines (57 loc) · 1.89 KB

File metadata and controls

83 lines (57 loc) · 1.89 KB

MD058 - Tables should be surrounded by blank lines

Tags: table, blank_lines
Aliases: blanks-around-tables

Description

This rule checks that tables are surrounded by blank lines above and below them.

Rationale

"In addition to aesthetic reasons, some parsers will incorrectly parse tables that don't have blank lines before and after them."

Ensuring tables have proper spacing improves:

  • Parser compatibility across different Markdown processors
  • Document readability and structure
  • Consistent formatting standards

Example of a Violation

Some text
| Header | Header |
| ------ | ------ |
| Cell   | Cell   |
> Blockquote

Example of Correct Formatting

Some text

| Header | Header |
| ------ | ------ |
| Cell   | Cell   |

> Blockquote

Key Points

  • Tables must have a blank line above them (unless at the start of the document)
  • Tables must have a blank line below them (unless at the end of the document)
  • Text immediately following a table can be considered part of the table by some parsers
  • This rule improves compatibility with various Markdown parsers

Configuration

This rule has no specific configuration options.

Fix

To fix this issue:

  1. Add a blank line above the table if there is content before it
  2. Add a blank line below the table if there is content after it

Example fix:

<!-- Before (violation) -->
Text above table.
| Header | Value |
| ------ | ----- |
| Data   | Info  |
Text below table.

<!-- After (corrected) -->
Text above table.

| Header | Value |
| ------ | ----- |
| Data   | Info  |

Text below table.

Related Rules