VALIDATION-PLANES-05: Allow interchangeable headings with oneOf
What it demonstrates
Section titled “What it demonstrates”oneOf([…]) accepts any one of several spellings at a single position as one logical slot.
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 { oneOf } from "markdown-contract";
const c = contract({ body: sections({ order: "strict" }, [ oneOf(["Summary", "Overview"]), // either heading fills the slot section("Details"),]) });// "## Overview" then "## Details" validates cleanSurfaces exercised
Section titled “Surfaces exercised”oneOf() / OneOfSpec (src/core/grammar.ts)one slot, multiple accepted names (src/core/structure.ts slotsOf)