Title: id(web): unused link reference definitions are silently deleted on save — a definitions-only document saves as an empty file · Issue #1004 · developing-today/code · GitHub
Open Graph Title: id(web): unused link reference definitions are silently deleted on save — a definitions-only document saves as an empty file · Issue #1004 · developing-today/code
X Title: id(web): unused link reference definitions are silently deleted on save — a definitions-only document saves as an empty file · Issue #1004 · developing-today/code
Description: Bug In the id web editor's markdown ↔ ProseMirror codec (pkgs/id/src/web/markdown.rs), link reference definitions that are not used by a link in the document are silently deleted on save: body text [unused]: https://example.com loads and...
Open Graph Description: Bug In the id web editor's markdown ↔ ProseMirror codec (pkgs/id/src/web/markdown.rs), link reference definitions that are not used by a link in the document are silently deleted on save: body text...
X Description: Bug In the id web editor's markdown ↔ ProseMirror codec (pkgs/id/src/web/markdown.rs), link reference definitions that are not used by a link in the document are silently deleted on save: body ...
Opengraph URL: https://github.com/developing-today/code/issues/1004
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(web): unused link reference definitions are silently deleted on save — a definitions-only document saves as an empty file","articleBody":"## Bug\n\nIn the id web editor's markdown ↔ ProseMirror codec (`pkgs/id/src/web/markdown.rs`), **link reference definitions that are not used by a link in the document are silently deleted on save**:\n\n```markdown\nbody text\n\n[unused]: https://example.com\n```\n\nloads and saves as just:\n\n```markdown\nbody text\n```\n\nThe extreme case is total: a document consisting only of reference definitions (a shared \"link library\" page, or a draft whose links are added later)\n\n```markdown\n[a]: https://a.com\n[b]: https://b.com\n```\n\nloads as an empty document and saves as an **empty file**.\n\nDefinitions that *are* used survive in substance — full (`[one][r]`), collapsed (`[text][]`) and shortcut (`[ref]`) references all round-trip, with the reference inlined as `[text](url)` and the definition consumed. So the loss is specifically: any definition whose label no link in the current document references.\n\n## Verified repro (this run, main 3b9d1592)\n\nStandalone verbatim-codec probe (evidence log: goal `hidden_files/probe-2026-10-26-1415/out4.log`):\n\n- `unused-ref-def`: `\"body text\\n\\n[unused]: https://example.com\\n\"` → PM is a single paragraph `body text` (the definition appears nowhere) → save returns `\"body text\\n\"`.\n- `ref-def-only-doc`: `\"[a]: https://a.com\\n[b]: https://b.com\\n\"` → PM is the empty-document placeholder paragraph → save returns `\"\"` (empty file).\n- Controls (same log): `shortcut-ref`, `collapsed-ref`, `multi-ref-same` — used definitions round-trip correctly as inlined links.\n\n## Why it happens / why it matters\n\nThe ProseMirror schema the codec targets has no node for a reference definition, and comrak resolves definitions during parsing without surfacing unused ones as AST nodes — so the parse direction has nowhere to put them and they vanish before the editor ever sees the document. Keeping a block of reference definitions at the foot of a note for later use is a standard markdown authoring pattern; opening such a file in the id web editor and saving (even with no edit) destroys that block with no warning. Same silent-loss-on-save family as #996 (empty links), in a distinct mechanism.\n\n## Suggested direction (triage to decide)\n\nThe fix needs a deliberate design choice, e.g.: (a) preserve unused definitions verbatim — the parse direction would need a source pre-scan for reference definitions, diff them against the labels comrak actually consumed, and carry the leftovers (e.g. as a trailing raw block the editor displays but does not eat); (b) represent definitions in the PM doc (a dedicated node) — cleaner but touches the editor schema; or (c) if neither is acceptable, document the limitation where the codec's schema is described (module doc comment at the top of markdown.rs) so the loss is at least a known, stated behaviour instead of a silent one. Doing nothing silently is the only unacceptable outcome.\n\n## Acceptance criteria\n\n- A document with an unused reference definition no longer loses it silently on a load/save round trip — either the definition survives (verbatim or in an equivalent reference form), or the limitation is explicitly documented in the codec module docs and this issue is closed citing that documentation.\n- Used references (full, collapsed, shortcut, multiple links sharing one definition) keep round-tripping exactly as today.\n- A definitions-only document does not save as an empty file under the chosen fix (or is covered by the documented limitation).\n- Existing `web::markdown` tests pass.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-26T19:20:53Z","url":"https://github.com/developing-today/code/issues/1004"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8f1ddf5f-e48c-9f8e-ce0a-66354e329174 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D6BE:87352:2DC055:3FCDDA:6B072EF5 |
| html-safe-nonce | be5d1c1e724f1f0114e7539e22873b0f74bf078723cd6d52994009965dac1dc6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENkJFOjg3MzUyOjJEQzA1NTozRkNEREE6NkIwNzJFRjUiLCJ2aXNpdG9yX2lkIjoiODk4MTc5MTA1MDM1MjI0MjQyMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 087503a3a7647b492e179003aac2f03a50d22ccb7c39ff8516935f90d3627cff |
| hovercard-subject-tag | issue:6046589107 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/1004/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b4f5cecc34d3abfdeb2c1434aa2268907f72311c2acdec633f3cb6a0e8ac96de/developing-today/code/issues/1004 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b4f5cecc34d3abfdeb2c1434aa2268907f72311c2acdec633f3cb6a0e8ac96de/developing-today/code/issues/1004 |
| og:image:alt | Bug In the id web editor's markdown ↔ ProseMirror codec (pkgs/id/src/web/markdown.rs), link reference definitions that are not used by a link in the document are silently deleted on save: body text... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2a60952cad7efb2604ea85e500208f51c1ec1943aa260ac605c13eb46a1ed83b |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 345c27626db08417fdfc84278a4415ae9a48d8f3 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width