27 - a placed block carries no headroom, so the list's directive items write none
CI / gate (push) Successful in 30s
CI / publish (push) Has been skipped

This commit is contained in:
2026-09-24 00:05:08 +02:00
parent d5370b126d
commit 68942c9919
3 changed files with 9 additions and 7 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ type BlockContainer = 'directive' | 'document' | 'list-item'
type BlockSpelling = 'commonmark' | 'directive' | 'list' type BlockSpelling = 'commonmark' | 'directive' | 'list'
type EmittedBlock = { headroom: number; spelling: BlockSpelling; text: string } type EmittedBlock = { headroom: number; spelling: BlockSpelling; text: string }
type KeptSpelling = { block: EmittedBlock | undefined; depth: number } type KeptSpelling = { block: EmittedBlock | undefined; depth: number }
type PlacedBlock = EmittedBlock & { node: AdfNode } type PlacedBlock = Omit<EmittedBlock, 'headroom'> & { node: AdfNode }
export type SpellingMemo = Map<AdfNode, KeptSpelling> export type SpellingMemo = Map<AdfNode, KeptSpelling>
type Walk = { blocks: readonly PlacedBlock[]; headroom: number } type Walk = { blocks: readonly PlacedBlock[]; headroom: number }
type WalkedItem = { node: AdfNode; walk: Walk } type WalkedItem = { node: AdfNode; walk: Walk }
@@ -256,7 +256,7 @@ function tryList(node: AdfNode, path: ConvertErrorPath, depth: number, memo: Spe
// The directive form sinks each item's blocks a level below where the walk read them. // The directive form sinks each item's blocks a level below where the walk read them.
function directiveItems(items: readonly WalkedItem[]): PlacedBlock[] { function directiveItems(items: readonly WalkedItem[]): PlacedBlock[] {
return items.map((item) => ({ ...directivePair(item.node, listItemOpener, joinBlocks(item.walk.blocks, 'directive'), item.walk.headroom - 1), node: item.node })) return items.map((item) => ({ ...directivePair(item.node, listItemOpener, joinBlocks(item.walk.blocks, 'directive')), node: item.node }))
} }
function listStart(node: AdfNode, items: number): number | undefined { function listStart(node: AdfNode, items: number): number | undefined {
+6
View File
@@ -1066,6 +1066,12 @@ The done `todo.md` items in full, as they were written. `todo.md` keeps a one-li
pass's set read-only and returns the whole. `containerStack` is the one writer of the stack, pass's set read-only and returns the whole. `containerStack` is the one writer of the stack,
`edges` and the open directives' depths by name, all read-only elsewhere; deriving `edges` from the `edges` and the open directives' depths by name, all read-only elsewhere; deriving `edges` from the
stack instead makes every line walk the open directives, quadratic in their nesting. stack instead makes every line walk the open directives, quadratic in their nesting.
- [x] **27 — The dead `headroom` write goes (`0.2.0`).** `directiveItems`
(`emit/adf-to-markdown.ts:258`) writes `item.walk.headroom - 1` onto each `PlacedBlock`, and
nothing on that path reads a block's `headroom`: `joinBlocks` and `separationBetween` read
`text` and `spelling`, and `emitDirectiveBlock` takes the level from the `Walk`. Of the two
subtractions three readers flagged as double-counting, this is the one that is dead.
`PlacedBlock` carries no `headroom`, so a placed block cannot be read for one.
## 5 — Ship `0.1.0` ## 5 — Ship `0.1.0`
+1 -5
View File
@@ -59,11 +59,7 @@ chunk clearing a §11 seam.
- [x] **24 — The conformance gates have a directory (`0.2.0`).** - [x] **24 — The conformance gates have a directory (`0.2.0`).**
- [x] **25 — AGENTS.md §8 and §11 are findable (`0.2.0`).** - [x] **25 — AGENTS.md §8 and §11 are findable (`0.2.0`).**
- [x] **26 — The two mutable structures say what they guarantee (`0.2.0`).** - [x] **26 — The two mutable structures say what they guarantee (`0.2.0`).**
- [ ] **27 — The dead `headroom` write goes (`0.2.0`).** `directiveItems` - [x] **27 — The dead `headroom` write goes (`0.2.0`).**
(`emit/adf-to-markdown.ts:258`) writes `item.walk.headroom - 1` onto each `PlacedBlock`, and
nothing on that path reads a block's `headroom`: `joinBlocks` and `separationBetween` read
`text` and `spelling`, and `emitDirectiveBlock` takes the level from the `Walk`. Of the two
subtractions three readers flagged as double-counting, this is the one that is dead.
- [x] **0 — Scaffold.** - [x] **0 — Scaffold.**
- [x] **1a — The directive grammar.** - [x] **1a — The directive grammar.**
- [x] **1b — Block node syntaxes.** - [x] **1b — Block node syntaxes.**