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
id(web): sized linked images still lose their href on reload — PR #888's <a><img></a> HTML emission has no parse counterpart (and editor parseDOM drops the wrapping link) #893
Finding (from pr-diff-review of PR #888, head d09a4f4)
PR #888 fixes #880 (linked images) for the plain markdown form, but the sized linked-image path it introduces does not round-trip, and its own test does not cover it.
Evidence
Save direction (PR #888, pkgs/id/src/web/markdown.rs, json_to_ast image arm): an image with width/height AND linkHref is emitted as an HtmlInline:
<ahref="HREF"><imgsrc="..." width="..." /></a>
Parse direction (current main, unchanged by #888): there is no parse counterpart for that form.
convert_node's HtmlInline arm calls parse_img_tag(html), and parse_img_tag (markdown.rs, current main) returns None unless the literal starts with <img . Comrak splits <a href="..."><img ... /></a> into separate inline HTML nodes, so the <a ...> and </a> pieces fall through to text_node_with_marks(...) — they become literal text nodes containing the anchor tags in the ProseMirror doc — and the <img> piece parses to an image node with no linkHref.
Second facet, same outcome via the editor: PR #888 adds linkHref/linkTitle to the editor image schema (pkgs/id/web/src/editor.ts) and renders ["a", ..., ["img", ...]] in toDOM, but the image node's parseDOMgetAttrs still reads only the <img> element's own attributes — it never looks at a wrapping <a> parent, so a linked image pasted or parsed from HTML enters the editor with its link already dropped.
Why it matters
If PR #888 merges as-is, it closes #880 while the sized variant of the same bug stays live — and gains a new symptom (literal anchor-tag text in documents). Sized images are the common case for linked screenshots/badges with explicit dimensions.
Acceptance criteria
A sized linked image (linkHref + width and/or height) survives a full markdown → ProseMirror → markdown round trip with href, dimensions, and alt intact, and produces no literal <a> text nodes; a Rust test in web::markdown pins this (mirroring the unsized test).
The parse direction handles the <a href="..."><img ... /></a> HTML form (e.g. anchor-aware handling in/around parse_img_tag or the HtmlInline arm), OR the sized emission changes to a form the parser already round-trips — either way the round-trip test above passes.
Activity
developing-today commentedon Oct 25, 2026
CODE-139
fix(id-web): sized linked images round-trip their href (#893)