Skip to content

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

Closed

Description

@dezren39

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:

<a href="HREF"><img src="..." width="..." /></a>

Parse direction (current main, unchanged by #888): there is no parse counterpart for that form.

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 parseDOM getAttrs 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions