2025-08-19 21:42:08 -07:00
|
|
|
# `MD060` - Table column style
|
|
|
|
|
|
|
|
|
|
Tags: `table`
|
|
|
|
|
|
|
|
|
|
Aliases: `table-column-style`
|
|
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
|
|
|
|
|
- `style`: Table column style (`string`, default `any`, values `aligned` /
|
|
|
|
|
`any` / `compact` / `tight`)
|
|
|
|
|
|
|
|
|
|
This rule is triggered when the column separators of a
|
|
|
|
|
[GitHub Flavored Markdown table][gfm-table-060] are used inconsistently.
|
|
|
|
|
|
2025-11-25 14:15:50 -08:00
|
|
|
This rule recognizes three table column styles based on popular use.
|
2025-08-19 21:42:08 -07:00
|
|
|
|
2025-11-25 14:15:50 -08:00
|
|
|
Style `aligned` ensures table delimiters are vertically aligned:
|
2025-08-19 21:42:08 -07:00
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
|
| Character | Meaning |
|
|
|
|
|
| --------- | ------- |
|
|
|
|
|
| Y | Yes |
|
|
|
|
|
| N | No |
|
|
|
|
|
```
|
|
|
|
|
|
2025-11-25 14:15:50 -08:00
|
|
|
The `aligned` style ignores cell content, so the following is also valid:
|
|
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
|
| Character | Meaning |
|
|
|
|
|
|-----------|---------|
|
|
|
|
|
| Y | Yes |
|
|
|
|
|
| N | No |
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Style `compact` avoids extra padding with a single space around cell content:
|
2025-08-19 21:42:08 -07:00
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
|
| Character | Meaning |
|
|
|
|
|
| --- | --- |
|
|
|
|
|
| Y | Yes |
|
|
|
|
|
| N | No |
|
|
|
|
|
```
|
|
|
|
|
|
2025-11-25 14:15:50 -08:00
|
|
|
Style `tight` uses no padding at all for cell content:
|
2025-08-19 21:42:08 -07:00
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
|
|Character|Meaning|
|
|
|
|
|
|---|---|
|
|
|
|
|
|Y|Yes|
|
|
|
|
|
|N|No|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
When this rule's `style` parameter is set to `aligned`, `compact`, or `tight`,
|
2025-11-25 14:15:50 -08:00
|
|
|
every table must match the corresponding pattern and any violations will be
|
|
|
|
|
reported. By default, or when the `any` style is used, each table is analyzed to
|
|
|
|
|
see if it satisfies any supported style. If so, no violations are reported. If
|
|
|
|
|
not, violations are be reported for whichever style would produce the *fewest*
|
|
|
|
|
issues (i.e., whichever style is the closest match).
|
|
|
|
|
|
|
|
|
|
Note: Delimiter placement for the `aligned` style is based on visual appearance
|
|
|
|
|
and not character count. Because editors typically render [emoji][emoji] and
|
|
|
|
|
[CJK characters][cjk-characters] at *twice* the width of
|
|
|
|
|
[Latin characters][latin-script], this rule takes that into account for tables
|
|
|
|
|
using the `aligned` style. The following table is correctly formatted and will
|
|
|
|
|
appear aligned in most editors and monospaced fonts:
|
2025-08-19 21:42:08 -07:00
|
|
|
|
|
|
|
|
<!-- markdownlint-capture -->
|
|
|
|
|
<!-- markdownlint-disable extended-ascii -->
|
|
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
|
| Response | Emoji |
|
|
|
|
|
| -------- | ----- |
|
2025-11-25 14:15:50 -08:00
|
|
|
| Yes | ✅ |
|
|
|
|
|
| No | ❎ |
|
2025-08-19 21:42:08 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<!-- markdownlint-restore -->
|
|
|
|
|
|
|
|
|
|
Rationale: Consistent formatting makes it easier to understand a document.
|
|
|
|
|
|
2025-11-25 14:15:50 -08:00
|
|
|
[cjk-characters]: https://en.wikipedia.org/wiki/CJK_characters
|
|
|
|
|
[emoji]: https://en.wikipedia.org/wiki/Emoji
|
2025-08-19 21:42:08 -07:00
|
|
|
[gfm-table-060]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
|
2025-11-25 14:15:50 -08:00
|
|
|
[latin-script]: https://en.wikipedia.org/wiki/Latin_script
|