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): linked images [![alt](src)](href) lose their link in the markdown ↔ ProseMirror codec — save strips the href · Issue #880 · developing-today/code

id(web): linked images [![alt](src)](href) lose their link in the markdown ↔ ProseMirror codec — save strips the href #880

New issue
Copy link
New issue
Copy link
Closed
#888
Closed
id(web): linked images [![alt](src)](href) lose their link in the markdown ↔ ProseMirror codec — save strips the href#880
#888
Copy link
Assignees
dezren39
Labels
status:done

Description

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

Bug

In pkgs/id/src/web/markdown.rs, a linked image — [![alt](img.png)](https://example.com) — loses its link in the markdown ↔ ProseMirror codec, in both directions:

  • Parse direction (convert_node, NodeValue::Link / NodeValue::Image arms, markdown.rs:~291-323 on main 45c817e): a Link node is converted via collect_inline_children, which flattens mark wrappers. The Image child is not a mark wrapper and is converted without the accumulated marks — the image branch never looks at active_marks — so the resulting ProseMirror image node carries only src/alt/title. The href is gone before the editor ever sees the document.
  • Save direction (json_to_ast): there is likewise no representation for an image wrapped in a link, so even a ProseMirror doc that somehow held the link could not emit one.

Verified repro (this run, main 45c817e)

Temporary probe test run with cargo test --features web --lib web::markdown:: (probe removed after the run; assertions below are the acceptance tests):

  1. markdown_to_prosemirror("[![alt](img.png)](https://example.com)") returns:
    {"type":"doc","content":[{"type":"paragraph","content":[{"type":"image","attrs":{"src":"img.png","alt":"alt"}}]}]} — no trace of https://example.com.
  2. prosemirror_to_markdown of that document emits: ![alt](img.png) — the link target is silently deleted on the first load/save round trip.

Why it matters

Linked images (badges, thumbnails linking to full-size images, screenshot links) are common in notes and docs. Opening such a document in the id web editor and saving it — even with no edits — permanently strips the link. Silent data loss on the save path, in the same codec family as #872/#873/#879 but a distinct node combination (Link wrapping Image).

Suggested fix (either representation is acceptable — pick what the editor schema supports)

  • Preferred: when an image is the sole child of a link, represent it in ProseMirror in a form the editor already understands for linked images, and teach json_to_ast to wrap the emitted NodeValue::Image in a NodeValue::Link for that form.
  • Or: carry the link as an attribute on the image node (e.g. linkHref) through both converters, with json_to_ast wrapping the image in a Link node (or emitting the [![alt](src)](href) form) when the attribute is present.
  • Images with additional siblings inside the link (e.g. [see ![alt](img.png) now](href)) should keep the existing text-mark behaviour for the text parts and must not crash or drop the image.

Acceptance criteria

  • Round-trip test: [![alt](img.png)](https://example.com) survives markdown_to_prosemirror → prosemirror_to_markdown with the href intact (exact emitted form may differ, but re-parsing it must yield an image inside a link to the same URL).
  • Plain images and plain text links round-trip exactly as before.
  • Existing web::markdown tests still pass (cargo test --features web --lib web::markdown::).
  • Coordination: PR fix(id-web): img attribute codec — sequential parse, escaped emission (#872, #873) #878 (for 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) is in flight in the same file — sequence or rebase so the img-codec changes do not conflict.

Activity

  1. developing-today commented on Oct 25, 2026

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

    CODE-133

  2. github-actions
    assigned
    dezren39
    on Oct 25, 2026
  3. dezren39 commented on Oct 25, 2026

    @dezren39
    dezren39
    on Oct 25, 2026
    MemberAuthor
    More actions

    Verification note from the filer (new-issue-creator): this issue was re-verified in a corrected probe run on main 45c817e and genuinely reproduces.

    Context: the original run's interim probe deliveries in this environment proved unreliable (a sibling issue filed the same run, #879, did not reproduce on re-check and has been closed as invalid). So all four filings from that run were re-run properly — crate compiled with a stub web/dist/manifest.json in place (the clone otherwise fails to compile the rust-embed Assets derive), probe log preserved by the filer.

    For this issue the re-run shows exactly the reported behaviour: the ProseMirror document for [![alt](img.png)](https://example.com) is a bare image node ({"attrs":{"alt":"alt","src":"img.png"},"type":"image"} — no href anywhere), and prosemirror_to_markdown emits ![alt](img.png). The link is lost, as filed.

  4. dezren39
    closed this as completedin #888on Oct 25, 2026
  5. dezren39
    added a commit that references this issue on Oct 25, 2026

    fix(id-web): codec round-trip — linked images, table alignment, multi…

    9cbbb0a
  6. developing-today
    added
    status:done
    on Oct 25, 2026
  7. dezren39
    added a commit that references this issue on Oct 27, 2026

    fix(id-web): preserve HTML blocks on save via code_block provenance a…

    ce1acfb
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.