# MD056 - Table column count

## Description

This rule is triggered when tables in a Markdown document have inconsistent column counts. All rows in a table should have the same number of cells for proper rendering.

While some Markdown renderers might handle tables with inconsistent column counts, the results can vary, and this can lead to unexpected rendering issues.

## Configuration

This rule does not have any specific configuration options. It simply checks that all rows in a table have the same number of cells as the first row (the header).

## Examples

### Valid

```markdown
| Header 1 | Header 2 | Header 3 |
| -------- | -------- | -------- |
| Cell 1.1 | Cell 1.2 | Cell 1.3 |
| Cell 2.1 | Cell 2.2 | Cell 2.3 |
```

```markdown
| Header 1 | Header 2 | Header 3 |
| -------- | -------- | -------- |
| Cell 1.1 |          | Cell 1.3 | <!-- Empty cells are fine -->
| Cell 2.1 | Cell 2.2 | Cell 2.3 |
```

### Invalid

```markdown
| Header 1 | Header 2 | Header 3 |
| -------- | -------- | -------- |
| Cell 1.1 | Cell 1.2 |          | <!-- Correct number of columns -->
| Cell 2.1 | Cell 2.2 |          | Cell 2.4 | <!-- Too many columns -->
| Cell 3.1 | Cell 3.2 |          <!-- Too few columns -->
```

## Special Cases

- Table content within code blocks is ignored
- A table is identified by the presence of a delimiter row (containing dashes and optionally colons)
- The rule processes tables that have at least a header row and a delimiter row
- The expected column count is determined from the first row of the table

## Fix

When automatically fixing issues:
- Rows with too many cells will have excess cells removed
- Rows with too few cells will have empty cells added

## Rationale

Consistent column counts are essential for proper table rendering across different Markdown parsers and viewers. Inconsistencies can lead to unexpected results and formatting issues.

## Benefits

- Improved table readability
- More reliable rendering across different Markdown parsers
- Easier table maintenance and data updates

## Related Rules

- [MD055](md055.md) - Table pipe style should be consistent
- [MD058](md058.md) - Tables should be surrounded by blank lines
