Repository navigation
Description
Bug
In the id web markdown codec (pkgs/id/src/web/markdown.rs), a link with empty text is silently deleted on save — the href is lost entirely.
Evidence (verified this run, main 14dd66b6)
Standalone probe crate compiling the verbatim codec from current main (log: goal hidden_files/probe-2026-10-26-1215/out.log + out3.log):
- Input:
[](https://e.com)\n- Parsed PM:
{"type":"paragraph"}— no content at all - Saved output:
""— the link and its URL are gone
- Parsed PM:
- Input:
before [](https://e.com) after\n- Parsed PM: two plain text nodes
before/after(no link mark anywhere) - Saved output:
before after\n(note the double space where the link was)
- Parsed PM: two plain text nodes
Root cause, parse side: NodeValue::Link arm (markdown.rs:299) converts a link purely into a mark carried by its child text nodes (collect_inline_children with the link mark pushed). A link with no children produces no text node, so the mark — and the href/title — has nothing to attach to and vanishes. There is no other PM representation for a standalone link in this codec (contrast: images, which are nodes, survive empty alt — [](https://e.com) round-trips fine).
Why it matters
Opening a markdown file containing an empty-text link (a placeholder link, a link inserted by another tool, or one whose text a user cleared in another editor) in id and saving any edit silently destroys the URL. It is unrecoverable from the saved file and invisible in the editor — the paragraph looks unchanged.
Acceptance criteria
[](https://e.com)andbefore [](https://e.com) aftersurvive a parse→save round-trip with the href (and title, when present) preserved, OR the codec takes an explicit, documented alternative (e.g. emitting the href as visible autolink text) — silently dropping it is the one unacceptable outcome; the chosen representation must be a round-trip fixpoint.- The editor-side implication is considered: if the chosen PM shape is one the web editor schema cannot represent, say so in the fix and choose the save-side preservation that keeps the file's data.
- New unit tests in
pkgs/id/src/web/markdown.rscover: empty link alone, empty link mid-paragraph, empty link with a title. - Existing codec tests pass; linked-image and normal link cases do not regress.
Related
- Distinct from id(web): inline code combined with another mark drops the other mark on save — code+link loses the link #953 (code+link drops the link mark on a non-empty text node — different mechanism: the
create_marked_textcode early-return) and id(web): marked spans crossing a soft line break corrupt or fragment on save — single-mark, non-fixpoint #981 (softbreak fragmentation of non-empty links).
Activity
developing-today commentedon Oct 26, 2026
CODE-170
dezren39 commentedon Oct 26, 2026
🤖 Agent note · state: filed
dezren39 commentedon Oct 26, 2026
🤖 Agent note · picked up
15 remaining items
dezren39 commentedon Oct 27, 2026
Resumed by queue worker (Lane A) — PR #1033 CI is now fully green; verifying diff and merging.
Merge pull request #1033 from developing-today/queue/1190-996-empty-link
dezren39 commentedon Oct 27, 2026
Done — PR #1033 merged (merge commit cf60812); issue auto-closed. All CI checks SUCCESS including test-web-unit with the new test_empty_link_roundtrips.