The memo stops the per-level re-spelling; it does not promise one spelling
CI / gate (push) Successful in 27s
CI / publish (push) Successful in 4s

This commit was merged in pull request #105.
This commit is contained in:
2026-09-19 13:48:55 +02:00
parent cd3bdf0d5d
commit 00e18d66b5
+7 -7
View File
@@ -313,15 +313,15 @@ someone spells it or pins it.
scan may keep what it read for a later walk of the same text, and the fallback where it kept
nothing must be the same reader over the same text at the same index, so the two cannot disagree
— which is what makes the kept value a memo rather than a second spelling (4c).
- The parse keeps each node's readable spelling in a memo, so the `commonMarkSpelling` ask spells a
node once rather than once per level above it (18). The node reference is the key, which holds
- The parse keeps each node's readable spelling in a memo, so the `commonMarkSpelling` ask stops
spelling a node once per level above it (18). The node reference is the key, which holds
because the parse builds one object per position; `adfToMarkdown` passes no memo, where a
consumer's document may hold one node at two positions (4b). `text` and `spelling` carry no depth
and `headroom` is affine in it, so a read at or above the depth that filled the entry rebases; a read
below re-spells, because a hit skips the depth guards the walk it replaces runs and an ordered
list past the marker cap gives way, spending two emitter levels where the parser spent one. A
give-way is kept too and serves any depth, reading the node's shape alone. Only what succeeded is
kept, so no path minted at another position is ever read.
and `headroom` is affine in it, so a read at or above the depth that filled the entry rebases; a
read below re-spells, because a hit skips the depth guards the walk it replaces runs and an
ordered list past the marker cap gives way, spending two emitter levels where the parser spent
one. A give-way is kept too and serves any depth, reading the node's shape alone. Only what
succeeded is kept, so no path minted at another position is ever read.
- No casts: `as`, `as unknown as`, non-null `!`. A boundary owes a type guard validating the
fields it claims (`isAdfDocument`); past it everything is typed. Make invalid states
unrepresentable.