Skip to content

VALIDATION-PLANES-07: Require a block kind: a table

section(…, {content: table({columns})}) makes the structure plane require a table block of that shape inside the section.

Builds on: VALIDATION-PLANES-02: The smallest contract: one required section

A TypeScript program against the library API; inline comments show the resulting values and behavior.

import { table } from "markdown-contract";
const c = contract({ body: sections({}, [
section("Changes", { content: table({ columns: ["File", "Kind"] }) }),
]) });
// "Changes" with no block -> structure/block-missing
// a block that is not a table -> structure/block-kind
  • table() content leaf (src/core/leaves.ts)
  • SectionOpts.content kind-gate (src/core/structure.ts kindGate)
  • structure/block-missing; structure/block-kind