VALIDATION-PLANES-13: Bound a paragraph's word count
What it demonstrates
Section titled “What it demonstrates”maxWords(n) constrains a section’s prose, emitting content/max-words at the paragraph’s line when exceeded.
Builds on: VALIDATION-PLANES-02: The smallest contract: one required section
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 { maxWords } from "markdown-contract";
const c = contract({ body: sections({}, [ section("Summary", { content: maxWords(25) }),]) });// a 40-word Summary paragraph -> content/max-words at its lineSurfaces exercised
Section titled “Surfaces exercised”maxWords() leaf (src/core/leaves.ts)content/max-words at the paragraph line (src/core/content.ts validateParagraph)