GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 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) · Issue #893 · developing-today/code

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

New issue
Copy link
New issue
Copy link
Closed
Closed
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
Copy link
Assignees
dezren39
Labels
status:done

Description

@dezren39
dezren39
opened on Oct 25, 2026
Issue body actions

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.

  • 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.
  • Result on the next open/save cycle: the href is lost anyway, and stray <a href="..."> / </a> text appears in the document — the same save-path data-loss family id(web): linked images [![alt](src)](href) lose their link in the markdown ↔ ProseMirror codec — save strips the href #880/id(web): parse_img_tag substring search lets data-src/data-width shadow the real img attributes — save rewrites the image URL #872/id(web): prosemirror_to_markdown emits img src/alt/title unescaped — quotes truncate values and can inject attributes on reparse #873 exist to fix, plus visible corruption.
  • PR fix(id-web): codec round-trip — linked images, table alignment, multi-node code blocks #888's new test test_linked_image_roundtrip_keeps_href covers only the unsized form ([![alt](img.png)](https://example.com)); no test round-trips a sized linked image.

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

  • 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.
  • Editor facet: pasting/parsing <a href="..."><img src="..."></a> in the web editor yields an image node with linkHref set (parseDOM reads the wrapping anchor), or this facet is explicitly split into its own tracked issue before id(web): linked images [![alt](src)](href) lose their link in the markdown ↔ ProseMirror codec — save strips the href #880 is closed.
  • id(web): linked images [![alt](src)](href) lose their link in the markdown ↔ ProseMirror codec — save strips the href #880 is not closed on the strength of the unsized fix alone while this issue is open.

Activity

  1. developing-today commented on Oct 25, 2026

    @developing-today
    developing-todayBot
    on Oct 25, 2026 – with developing.today
    Contributor
    More actions

    CODE-139

  2. github-actions
    assigned
    dezren39
    on Oct 25, 2026
  3. dezren39
    added a commit that references this issue on Oct 25, 2026

    fix(id-web): sized linked images round-trip their href (#893)

    51e6e96
  4. dezren39
    closed this as completedin 9cbbb0aon Oct 25, 2026
  5. developing-today
    added
    status:done
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

status:done

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.