Repository navigation
Description
Problem
In pkgs/id's web markdown codec, any inline markup inside an image's alt text is silently stripped on the first open→save: emphasis, strong, code spans, and nested links in the description are flattened to their plain text. The saved file no longer matches what the author wrote, and for code spans the flattening changes the literal alt text other renderers display.
Verified on main 37418e56 with a verbatim-codec probe crate (comrak 0.56.0; hidden_files/probe-2026-10-27-0854-laneA/out.log + out3.log):
| Input | Saved |
|---|---|
 |
 |
 |
 |
 |
 |
 b](/x.png) |
 |
Controls in the same probe: a direct comrak parse→format_commonmark round-trip with the codec's own options preserves every one of these byte-for-byte (, ), so this is a codec loss, not a comrak renderer behaviour. Alt text containing an escaped bracket (![a\]b](/x.png)) and entities round-trip fine — only markup structure is lost.
Root cause
Parse direction, pkgs/id/src/web/markdown.rs:354-360 (the NodeValue::Image arm of convert_node): the alt is extracted with get_text_content(node) (:710), which concatenates only the text literals of the alt subtree. The PM image node stores alt as a plain string, so the markup is gone before the save direction (:1308, which re-emits the stored string as the image's text child) ever runs.
Why it matters
Alt text with emphasis or code spans is ordinary in imported notes and documentation (e.g. ). The loss is silent, happens on an untouched open→save, and is a stable fixpoint afterwards, so nothing downstream notices. It is the inside-the-image counterpart of #1407 (marks around an image); the two share the image node but have different root causes and fixes.
Acceptance criteria
,, andround-trip with the alt markup preserved (exact markdown, or a form that re-parses to the same alt structure and renders the same alt text).- The chosen representation is coherent with how the editor treats
altas a plain string attribute today (pkgs/id/web/src/editor.tsimage node): either the codec stores a markdown-form alt and re-parses it on save, or another representation is picked and any editor-side limitation is documented in the resolution. - Nested-link alt (
 b](/x.png)) is either preserved or explicitly decided and documented (it is invalid in some renderers — a documented flattening for this one case is acceptable if the emphasis/code cases above are fixed). - Regression tests in
pkgs/id/src/web/markdown.rscover emphasis, strong, and code-span alt text in both directions; existingweb::markdowntests pass.
Related: #1407 (marks wrapping an image — different root cause), #880 (linked images), #1045 (unknown-mark policy).
Activity
developing-today commentedon Oct 27, 2026
CODE-507
dezren39 commentedon Oct 27, 2026
🤖 Agent note · filed
dezren39 commentedon Oct 27, 2026
🤖 Agent note · picked up
39 remaining items
dezren39 commentedon Oct 27, 2026
🤖 Agent note · parked
dezren39 commentedon Oct 28, 2026
🤖 Agent note · picked up
queue/1414-1417-alt-markupMerge pull request #1471 from developing-today/queue/1414-1417-alt-ma…
dezren39 commentedon Oct 28, 2026
🤖 Agent note · done
chore(flake): bump opencode_2 to 401ba065 (opencode: bench ladder #1305…