Repository navigation
Description
Finding
PR #1022 (merged, merge commit 76672b9) preserves spaced link/image destinations by swapping each one for a deterministic placeholder before rendering and restoring it afterwards with a global string replace over the whole rendered document:
pkgs/id/src/web/markdown.rs (current main):
:1100-1103— placeholder isformat!("idweb-spaced-destination-{}-placeholder", substitutions.len()), derived only from the substitution index; nothing checks whether that token already occurs in the document.:1070-1072— restoration isoutput = output.replace(&placeholder, &format!("<{raw}>")), which replaces EVERY occurrence in the rendered markdown, not just the destination the renderer emitted.
Why it matters
If the document's own text (or a code block, or another non-spaced destination) literally contains idweb-spaced-destination-0-placeholder and the document also has a spaced link/image destination, the save direction rewrites the document's own text into <the spaced destination> — silent content corruption on save, in the same codec family as the %20 mutation #1022 set out to fix. The token is fixed and guessable, so the collision does not require exotic input for anyone documenting this codec. The tests added by #1022 cover destinations, titles, and editor hrefs, but not a document that already contains the placeholder token. Verified still present on current main (2026-10-27).
Evidence
- PR: fix(id-web): preserve spaced link/image destinations in angle form on save (#1019) #1022 —
fix(id-web): preserve spaced link/image destinations in angle form on save (#1019) pkgs/id/src/web/markdown.rs:1081substitute_spaced_destinations— no scan of existing document text/URLs before choosing tokenspkgs/id/src/web/markdown.rs:1070-1072— globalstr::replacerestoration- Dedup: id(web): link/image destinations with a space are silently rewritten to %20 on save — angle-bracket form lost, relative file links break #1019 (closed) was the %20 rewrite itself; no open or closed issue mentions the placeholder collision.
Acceptance criteria
- Placeholder tokens are chosen so they cannot collide with content already in the document (e.g. scan the AST's text/literal/url content and keep extending/randomizing the token until it is absent), OR restoration is scoped to the rendered destination positions instead of a global replace.
- Regression test: a document containing the literal current token text plus a spaced link destination round-trips with the literal text unchanged and the destination in
<...>angle form. - Existing id(web): link/image destinations with a space are silently rewritten to %20 on save — angle-bracket form lost, relative file links break #1019 tests (spaced link, spaced image, title, editor href) still pass and round-trips remain fixpoints.
Activity
developing-today commentedon Oct 27, 2026
CODE-450
dezren39 commentedon Oct 27, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 2, 2026
🤖 Agent note · handed off
fix(id-web): collision-proof spaced-destination placeholders on save (#…
dezren39 commentedon Nov 3, 2026
🤖 Agent note · state: handed off
83 remaining items
dezren39 commentedon Nov 6, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 6, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 6, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 6, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 6, 2026
🤖 Agent note · handed off