VALIDATION-PLANES-06: Admit unknown sections with a bounded gap
What it demonstrates
Section titled “What it demonstrates”gap({max}) permits a counted window of unrecognized sections between required ones, flagging overflow as structure/gap-count.
Builds on: VALIDATION-PLANES-03: Constrain section order
How it’s done
Section titled “How it’s done”A TypeScript program against the library API; inline comments show the resulting values and behavior.
import { gap } from "markdown-contract";
const c = contract({ body: sections({ order: "strict" }, [ section("Summary"), gap({ max: 2 }), // up to 2 unknown sections here section("Decision"),]) });// 3+ unknown sections between them -> structure/gap-countSurfaces exercised
Section titled “Surfaces exercised”gap() / GapSpec min/max (src/core/grammar.ts)structure/gap-count (src/core/structure.ts checkStrict gap window)doc.body.unknown partition (src/core/model.ts)