CONSUME-AS-DATA-08: Traverse nested subsections
What it demonstrates
Section titled “What it demonstrates”SectionView.sections is itself a dual-key group of the nested H3 subsections.
Builds on: CONSUME-AS-DATA-03: Walk a SectionView’s content surface
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.
const c = contract({ body: sections({ allowUnknown: true }, [ optional(section("Post-mortem", { children: sections({ order: "strict" }, [ section("Acceptance criteria coverage"), section("What worked"), ]) })),])});
const pm = c.read(src, { path: "T-AB12.md" }).body.postMortem;pm.sections.whatWorked.text(); // camelCase keypm.sections.section("What worked").text(); // exact-heading accessor — same viewSurfaces exercised
Section titled “Surfaces exercised”section() children: sections()nested SectionView.sections dual-key groupoptional()