You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A link href with an unbalanced parenthesis breaks the Markdown round-trip #47
A link whose href contains an unbalanced ) breaks the canonical round-trip contract.
src/core/canonicalText.ts — renderText emits [label](href) with the href unescaped.
src/core/parseCanonical.ts:338-371 — parseLink closes the href on the first ) that balances.
A Paragraph containing [x](https://e.com/a)) re-parses as link https://e.com/a plus a stray )
text node, and re-serialising produces [x](https://e.com/a)) again — so canonicalText(parseCanonical(t)) !== canonicalText(t).
Impact
Narrow but real: a Document imported from Markdown that happens to contain such a URL is silently
changed on import, and a later export writes a different string than the Writer's source. The
canonical string is what model Passes and Anchors see, so it must be a faithful round-trip.
Fix
Percent-encode or backslash-escape ( and ) in an emitted href (and unescape in parseLink), or
use a delimiter that cannot appear in an href.
Why the fuzz test misses it
src/core/canonicalText.test.ts's adversarial fuzz only builds Paragraphs of plain text — it never
emits a link — so the round-trip invariant is only checked for the cases the renderer already
handles.
Origin
Found by the Thermos review (thermo-nuclear, core/wire).
Fixed in #71 (merged into v1.3). An href is written raw when its parentheses balance and it has no backslash, so existing canonical strings (and the Anchors over them) do not move; otherwise \, ( and ) are backslash-escaped and unescaped on parse. A link-building fuzz now covers the round-trip.
Note: an href containing a backslash (e.g. C:\path) is now escaped, so such a Document's canonical string moves once.
Activity
A link href with an unbalanced parenthesis breaks the Markdown round-…
kiran-brahma commentedon Sep 26, 2026
Fixed in #71 (merged into
v1.3). An href is written raw when its parentheses balance and it has no backslash, so existing canonical strings (and the Anchors over them) do not move; otherwise\,(and)are backslash-escaped and unescaped on parse. A link-building fuzz now covers the round-trip.Note: an href containing a backslash (e.g.
C:\path) is now escaped, so such a Document's canonical string moves once.Generated by Claude Code