CONSUME-AS-DATA-03: Walk a SectionView's content surface
What it demonstrates
Section titled “What it demonstrates”A SectionView exposes name, pos, anchors, text(scope), tables/table and lists, with absent optionals reading as undefined.
Builds on: CONSUME-AS-DATA-02: Read one section’s prose two ways
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 s = doc.body.summary;s.name; // "Summary"s.pos; // { line: 1, col: 1 } — heading SourcePoss.anchors; // ["summary"] — its ^block-idss.text("all"); // prose + block text flatteneds.tables; // TableView[] (s.table for the sole one)s.lists; // ListView[]doc.body.why?.text(); // undefined — absent optional section short-circuitsSurfaces exercised
Section titled “Surfaces exercised”SectionView.name/.pos/.anchors.text("prose"|"all").tables/.table.listsabsent-optional reads