columns
Which columns a table must have, and whether extra columns are allowed.
Navigator: The star chart has columns for a reason.
Quick reference
| Written as | Fails with | Applies to |
|---|---|---|
columns. autofix | table-columns-mismatch error | table |
strict fix: opt-in | table-extra-columns error | table |
Examples
columns. has
Require the table to contain these columns, in order; extra columns are allowed (add strict to forbid them).
The required columns in order pass
<!-- mdv: section required -->
## Crew
<!-- mdv: table columns.has=[Name, Role] -->
| Name | Role |
| ---- | ---- |
| Ines | Pilot |## Crew
| Name | Role | Shift |
| ---- | ---- | ----- |
| Ines | Pilot | Night |✓ passes
A missing column is flagged
<!-- mdv: section required -->
## Crew
<!-- mdv: table columns.has=[Name, Role] -->
| Name | Role |
| ---- | ---- |
| Ines | Pilot |## Crew
| Name | Shift |
| ---- | ----- |
| Ines | Night |✗ table-columns-mismatch error · line 3
strict
Reject header columns not listed in columns.has=; written as strict on a table, and without columns.has= it has no effect.
An extra column is flagged
<!-- mdv: section required -->
## Crew
<!-- mdv: table columns.has=[Name, Role] strict -->
| Name | Role |
| ---- | ---- |
| Ines | Pilot |## Crew
| Name | Role | Shift |
| ---- | ---- | ----- |
| Ines | Pilot | Night |✗ table-extra-columns error · line 3
Exactly the listed columns passes
<!-- mdv: section required -->
## Crew
<!-- mdv: table columns.has=[Name, Role] strict -->
| Name | Role |
| ---- | ---- |
| Ines | Pilot |## Crew
| Name | Role |
| ---- | ---- |
| Ines | Pilot |✓ passes
See also: Validate a status table