# MD058 - Tables Should Have Surrounding Blank Lines

## Description

This rule ensures that tables in Markdown documents have blank lines before and after them. This improves readability and ensures proper rendering across different Markdown processors.

## Configuration

This rule has the following configuration options:

- `minimum_before`: The minimum number of blank lines required before a table (default: 1)
- `minimum_after`: The minimum number of blank lines required after a table (default: 1)

Example configuration:

```json
{
  "MD058": {
    "minimum_before": 1,
    "minimum_after": 1
  }
}
```

## Examples

### Valid

```markdown
Some text before the table.

| Header 1 | Header 2 |
|----------|----------|
| Cell 1   | Cell 2   |

Some text after the table.
```

### Invalid

```markdown
Some text before the table.
| Header 1 | Header 2 |
|----------|----------|
| Cell 1   | Cell 2   |
Some text after the table.
```

### Fixed

```markdown
Some text before the table.

| Header 1 | Header 2 |
|----------|----------|
| Cell 1   | Cell 2   |

Some text after the table.
```

## Special Cases

- Tables in code blocks are ignored
- A blank line is defined as a line containing no characters or only whitespace
- Tables at the beginning of a document don't need a preceding blank line
- Tables at the end of a document don't need a following blank line
- A table is identified by the presence of a delimiter row (containing dashes and optionally colons)

## Fix

When automatically fixing issues:
- A blank line will be added before a table if it's missing and the table is not at the beginning of the document
- A blank line will be added after a table if it's missing and the table is not at the end of the document

## Rationale

Adding blank lines around tables improves document readability and helps ensure that tables are correctly recognized  
by Markdown parsers. Without blank lines, some parsers might not correctly identify table boundaries, especially  
when tables are adjacent to other content.

## Benefits

- Improved readability
- Consistent formatting
- Better compatibility with different Markdown processors
- Clearer document structure

## Related Rules

- [MD055 - Table Column Count](md055.md): Ensures tables have consistent column counts
- [MD056 - Table Column Spacing](md056.md): Ensures consistent spacing in table columns
