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 asFails withApplies to
columns.has=… autofixtable-columns-mismatch errortable
strict fix: opt-intable-extra-columns errortable

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

contract.mdv.md
<!-- mdv: section required -->
## Crew
<!-- mdv: table columns.has=[Name, Role] -->
| Name | Role |
| ---- | ---- |
| Ines | Pilot |
document.md
## Crew

| Name | Role | Shift |
| ---- | ---- | ----- |
| Ines | Pilot | Night |

✓ passes

A missing column is flagged

contract.mdv.md
<!-- mdv: section required -->
## Crew
<!-- mdv: table columns.has=[Name, Role] -->
| Name | Role |
| ---- | ---- |
| Ines | Pilot |
document.md
## 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

contract.mdv.md
<!-- mdv: section required -->
## Crew
<!-- mdv: table columns.has=[Name, Role] strict -->
| Name | Role |
| ---- | ---- |
| Ines | Pilot |
document.md
## Crew

| Name | Role | Shift |
| ---- | ---- | ----- |
| Ines | Pilot | Night |

✗ table-extra-columns error · line 3

Exactly the listed columns passes

contract.mdv.md
<!-- mdv: section required -->
## Crew
<!-- mdv: table columns.has=[Name, Role] strict -->
| Name | Role |
| ---- | ---- |
| Ines | Pilot |
document.md
## Crew

| Name | Role |
| ---- | ---- |
| Ines | Pilot |

✓ passes

See also: Validate a status table

On this page