Title: id(web): nested marks corrupt on save — em/strike/code inside strong/em gain entities and multiplied delimiters, several non-fixpoint · Issue #968 · developing-today/code · GitHub
Open Graph Title: id(web): nested marks corrupt on save — em/strike/code inside strong/em gain entities and multiplied delimiters, several non-fixpoint · Issue #968 · developing-today/code
X Title: id(web): nested marks corrupt on save — em/strike/code inside strong/em gain entities and multiplied delimiters, several non-fixpoint · Issue #968 · developing-today/code
Description: Summary In the id web editor's markdown ↔ ProseMirror codec (pkgs/id/src/web/markdown.rs), any nested mark combination corrupts on save: when the active mark set changes mid-run (emphasis inside strong, strong inside emphasis, strikethro...
Open Graph Description: Summary In the id web editor's markdown ↔ ProseMirror codec (pkgs/id/src/web/markdown.rs), any nested mark combination corrupts on save: when the active mark set changes mid-run (emphasis inside st...
X Description: Summary In the id web editor's markdown ↔ ProseMirror codec (pkgs/id/src/web/markdown.rs), any nested mark combination corrupts on save: when the active mark set changes mid-run (emphasis insid...
Opengraph URL: https://github.com/developing-today/code/issues/968
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(web): nested marks corrupt on save — em/strike/code inside strong/em gain entities and multiplied delimiters, several non-fixpoint","articleBody":"## Summary\n\nIn the id web editor's markdown ↔ ProseMirror codec (`pkgs/id/src/web/markdown.rs`), any **nested mark combination** corrupts on save: when the active mark set changes mid-run (emphasis inside strong, strong inside emphasis, strikethrough or inline code nested inside strong/em, emphasis inside a link), the emitted markdown gains ` ` HTML entities in place of spaces and multiplied emphasis delimiters. Several cases are **not a fixpoint** — every subsequent save makes the output worse.\n\nSingle-mark and sibling cases are fine (plain `**strong**`, `*em*`, `~~strike~~`, `` `code` ``, and `***both***` all round-trip cleanly), which is why the existing tests miss this: the corruption only appears when adjacent text nodes carry *different overlapping* mark sets.\n\n## Evidence (verified this run on main aa0d6d10)\n\nStandalone probe crate compiling the verbatim codec from `pkgs/id/src/web/markdown.rs` (current main), markdown → ProseMirror → markdown, twice:\n\n| Input | After 1st save | After 2nd save |\n|---|---|---|\n| `**bold _em_ end**` | `**bold *****em***** end**` | `**bold *******em******* end**` (keeps growing) |\n| `*em **strong** end*` | `*em ****strong**** end*` | stable in corrupted form |\n| `**bold ~~strike~~ end**` | `**bold **~~**strike**~~** end**` | `**bold ****~~strike~~**** end**` (changes again) |\n| `**bold \\`code\\` end**` | `**bold **\\`code\\`** end**` | — |\n| `*em \\`code\\` end*` | `*em *\\`code\\`* end*` | — |\n| `**_em_ rest**` | `***em***** rest**` | — |\n| `[link *em* text](https://e.com)` | `[link ](https://e.com)*[em](https://e.com)*[ text](https://e.com)` | `[*em*]` migrates inside the link on the next save (not a fixpoint) |\n| `**a *b \\`c\\` d* e**` | `**a *****b ***\\`c\\`*** d***** e**` | — |\n\nThe parsed ProseMirror is correct in every case (e.g. `**bold _em_ end**` parses to text nodes `bold ` [strong], `em` [strong, em], ` end` [strong]) — the corruption is introduced on the **emit** side.\n\nProbe logs: goal workspace `hidden_files/probe-2026-10-26-0815/out.log` and `out2.log`.\n\n## Suspected area\n\n`prosemirror_to_markdown`'s inline emission: `create_marked_text` (markdown.rs:1117) and `build_mark_chain` (markdown.rs:1167). When consecutive text nodes have overlapping-but-different mark sets, the chain appears to close/reopen marks in an order that leaves boundary text nodes whose leading/trailing spaces comrak then renders as ` `, and re-parsing the result produces yet more mark boundaries — hence the per-save growth.\n\nRelated but distinct: #944 (strong+link mark-order oscillation — no nesting required), #953 (code+link drops the link via the code early-return at markdown.rs:1122). This issue reproduces with no link and no code mark at all (pure em+strong), so it is not a duplicate of either; a fix should be checked against both.\n\n## Why it matters\n\nNested emphasis is ordinary writing (`**bold with *italic* inside**`). Today, opening such a file in the web editor and saving it — even without edits — rewrites it into entity-escaped, delimiter-doubled text, and repeated saves compound the damage. This is silent data corruption of user documents.\n\n## Acceptance criteria\n\n- [ ] `**bold _em_ end**`, `*em **strong** end*`, `**bold ~~strike~~ end**`, `**bold \\`code\\` end**`, `**_em_ rest**`, and `[link *em* text](url)` each round-trip open → save byte-identical (modulo the codec's documented normalizations), and a second round-trip is a fixpoint.\n- [ ] No ` ` (or other HTML entities for ordinary spaces) appear in emitted markdown for these inputs.\n- [ ] New unit tests in `pkgs/id/src/web/markdown.rs` cover nested-mark round-trips, including the fixpoint (double round-trip) property.\n- [ ] Existing codec tests still pass, and the #944 / #953 cases do not regress.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-26T13:28:27Z","url":"https://github.com/developing-today/code/issues/968"}
| 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:7e4808e4-2fd5-c338-c144-28352646dd2b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9026:3F83D3:588363:731A5F:6B0620FE |
| html-safe-nonce | ec663638c0620cd930256057c3ed277fea501e87e8e783213c6968a6240a0db1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDI2OjNGODNEMzo1ODgzNjM6NzMxQTVGOjZCMDYyMEZFIiwidmlzaXRvcl9pZCI6IjIzNTkzOTEwMDExMDM0NDIxNzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7fc445c071b90df65e1b7d899241f879b068705c104392ade9445289e52431f9 |
| hovercard-subject-tag | issue:6040626812 |
| 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/968/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7cf5c6f2f82882d2dce28bf8db2ed6a5b2aae33edddae9d8cc90fe81e869b69a/developing-today/code/issues/968 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7cf5c6f2f82882d2dce28bf8db2ed6a5b2aae33edddae9d8cc90fe81e869b69a/developing-today/code/issues/968 |
| og:image:alt | Summary In the id web editor's markdown ↔ ProseMirror codec (pkgs/id/src/web/markdown.rs), any nested mark combination corrupts on save: when the active mark set changes mid-run (emphasis inside st... |
| 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 | 9a7c5824b75ea2ec5e3de73a483229c7bb9f32a774ffd401f010dd9bacf1483d |
| 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 | b25c3080e84402f75431d8dc7a96b2635219cec7 |
| ui-target | full |
| 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