MD060 - Table Column Style
Table column style should be consistent.
Why This Rule Exists
Markdown table cells can be padded with spaces in different ways. Mixing styles within the same table, or between tables in the same document, makes source files harder to scan and signals that rows were edited by hand at different times without reformatting the table.
Styles
- Compact - no padding at all around cell content:
|A|B| - Tight - one or more spaces of padding around cell content:
| A | B | - Aligned - a table-level label rather than a cell-level one. A table is classified aligned when at least one of its cells has more than one trailing space, which is what happens when padding is used to line columns up. The cells of such a table are still individually classified as tight.
Because a cell is only ever classified compact or tight, the comparison the rule performs is padded against not padded. It never measures column widths, and it never counts padding beyond the first space.
By default the rule detects the style from the first table in the document and enforces it on every table, including that first one. A mismatch inside a single table is reported, which is what the example below shows.
Examples
Incorrect
| A | B |
|---|---|
|1| 2 |
The header row uses tight style (| A |), but the data row mixes compact
(|1|) and tight (2) cells.
Correct
| A | B |
|---|---|
| 1 | 2 |
Every cell uses the same single-space padding.
Aligned Style
| Column 1 | Col 2 | Column 3 |
|----------|-------|----------|
| Value 1 | V2 | Value 3 |
| V4 | Val 5 | V6 |
Extra trailing spaces are never a violation. In consistent mode a table
like this one is detected as aligned, and that detection then requires the
rest of the document only to pad its cells: a plain | A | B | table passes
against it.
Tables inside fenced code blocks are ignored.
Configuration
[MD060]
# Options: "aligned", "compact", "tight", "any", "consistent"
style = "consistent"
style
consistent(default) - detect the style from the first table in the document and enforce it on every table, the first one included.tight- require at least one space of padding around cell content. It does not require exactly one:| A |passes, and so does a table whose padding varies per column. Only a cell with no padding at all is a violation.aligned- the same check astight. It rejects cells with no padding and accepts every padded cell, so a plain| A | B |table passes. Nothing in the rule requires columns to line up when this is set; the only difference fromtightis the word used in the violation message.compact- require no padding around cell content. Any padded cell is a violation.any- disable the check entirely; any mix of styles is allowed.
When to Disable
- Documents that assemble tables from multiple generated sources
- Content where table formatting is not worth normalizing
Rule Details
- Rule ID: MD060
- Aliases: table-column-style
- Category: Formatting
- Severity: Warning
- Auto-fix: No