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 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 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). — 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 - The parse keeps each node's readable spelling in a memo, so the `commonMarkSpelling` ask stops
node once rather than once per level above it (18). The node reference is the key, which holds 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 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 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 and `headroom` is affine in it, so a read at or above the depth that filled the entry rebases; a
below re-spells, because a hit skips the depth guards the walk it replaces runs and an ordered read below re-spells, because a hit skips the depth guards the walk it replaces runs and an
list past the marker cap gives way, spending two emitter levels where the parser spent one. A ordered list past the marker cap gives way, spending two emitter levels where the parser spent
give-way is kept too and serves any depth, reading the node's shape alone. Only what succeeded is one. A give-way is kept too and serves any depth, reading the node's shape alone. Only what
kept, so no path minted at another position is ever read. 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 - 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 fields it claims (`isAdfDocument`); past it everything is typed. Make invalid states
unrepresentable. unrepresentable.