Title: id(web): adjacent lists of different types save an comment that reopens as a phantom code block · Issue #1397 · developing-today/code · GitHub
Open Graph Title: id(web): adjacent lists of different types save an comment that reopens as a phantom code block · Issue #1397 · developing-today/code
X Title: id(web): adjacent lists of different types save an comment that reopens as a phantom code block · Issue #1397 · developing-today/code
Description: Problem In the id web markdown codec (pkgs/id/src/web/markdown.rs), a document where a list is immediately followed by a list of a different type — bullet → ordered, ordered → bullet, or task → bullet with no blank line between them — is...
Open Graph Description: Problem In the id web markdown codec (pkgs/id/src/web/markdown.rs), a document where a list is immediately followed by a list of a different type — bullet → ordered, ordered → bullet, or task → bul...
X Description: Problem In the id web markdown codec (pkgs/id/src/web/markdown.rs), a document where a list is immediately followed by a list of a different type — bullet → ordered, ordered → bullet, or task → bul...
Opengraph URL: https://github.com/developing-today/code/issues/1397
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(web): adjacent lists of different types save an \u003c!-- end list --> comment that reopens as a phantom code block","articleBody":"## Problem\n\nIn the id web markdown codec (`pkgs/id/src/web/markdown.rs`), a document where a list is **immediately followed by a list of a different type** — bullet → ordered, ordered → bullet, or task → bullet with no blank line between them — is corrupted on save: the save writes a literal `\u003c!-- end list -->` HTML comment between the lists, and reopening the saved file turns that comment into a spurious `code_block` node sitting between the lists in the document model.\n\n#1032 fixed this for adjacent **bullet** lists (different markers) by coalescing them on save. Different-type neighbours cannot be coalesced — a bullet list and an ordered list are genuinely different lists — so the boundary case #1032 excluded is still live.\n\n## Evidence (verified this run on main `452d69e6`; `markdown.rs` identical at `95bfedb4` where the probe copy was taken)\n\nProbe: verbatim copy of `pkgs/id/src/web/markdown.rs` in a standalone crate (comrak 0.56), `markdown_to_prosemirror` → `prosemirror_to_markdown` → re-parse. Log: fleet bookkeeping `probe-2026-10-27-creator-a3/out4.log` (cases also in `out3.log`).\n\n| Input | Save output | Re-parsed PM |\n|---|---|---|\n| `- a\\n1. b\\n` | `- a\\n\\n\u003c!-- end list -->\\n\\n1. b\\n` | bullet_list, **`code_block{params:\"html\", htmlBlock:true}` containing `\u003c!-- end list -->`**, ordered_list |\n| `1. a\\n- b\\n` | `1. a\\n\\n\u003c!-- end list -->\\n\\n- b\\n` | ordered_list, **same spurious code_block**, bullet_list |\n| `- a\\n- b\\n1. c\\n2. d\\n` | comment inserted at the type boundary | **same spurious code_block** between the lists |\n| `1. [ ] t\\n- plain\\n` | `1. [ ] t\\n\\n\u003c!-- end list -->\\n\\n- plain\\n` | task_list, **same spurious code_block**, bullet_list |\n| `> - a\\n> 1. b\\n` (inside blockquote) | `> - a\\n> \\n> \u003c!-- end list -->\\n> \\n> 1. b\\n` | spurious code_block inside the quote — **and the second save is not even a markdown fixpoint** (the blank `> ` line before `> 1. b` is dropped) |\n\nRoot cause, both directions:\n\n- Save: `json_to_ast`'s child loop coalesces only consecutive `bullet_list` siblings (`markdown.rs:1464-1487`, the #1032 fix; its comment notes ordered/task lists are deliberately untouched). Any other adjacent list-type pair is emitted as sibling comrak `List` nodes, and comrak's CommonMark renderer separates sibling lists of different types with an `\u003c!-- end list -->` comment.\n- Parse: the comment comes back as an `HtmlBlock`, and the `NodeValue::HtmlBlock` arm (`markdown.rs:391-419`, the #982 fallback) converts it into a `code_block` with `params:\"html\"` / `htmlBlock:true`. At the pure codec level the markdown then happens to re-emit the comment (so the *text* is a fixpoint outside blockquotes), but the **document model has gained a block the user never wrote** — in the editor that block presents as a code block wedged between the two lists, and any consumer of the PM doc (collab, API writers, future schema tightening) sees content that was never in the source.\n\nControls from the same probe: same-type adjacent lists (post-#1032), blank-line-separated lists, nested lists, and task/plain *nested* sublists all round-trip cleanly; only same-level different-type adjacency breaks.\n\n## Why it matters\n\nSwitching from bullets to numbered steps mid-document without a blank line is a common note-taking shape (a shopping list followed by numbered prep steps; an agenda followed by action items). Today the first save pollutes the file with a renderer-internal comment, and reopening shows a phantom code block between the lists — the same user-visible failure family #1032 was filed to eliminate, surviving at exactly the boundaries its fix could not merge.\n\n## Acceptance criteria\n\n- [ ] All five shapes above save with **no** `\u003c!-- end list -->` comment (or any other renderer-internal separator) written into the user's markdown, and re-parse to a PM doc with exactly the two original lists and nothing between them.\n- [ ] The blockquote shape is a full markdown fixpoint across two saves.\n- [ ] The chosen separation strategy is coherent with the #1032 precedent and the #982 HTML-block provenance design, with a note in the PR on what separates the lists in the saved text (e.g. a separator the parse direction provably drops, or a save-direction rewrite that avoids sibling different-type `List` nodes reaching the renderer).\n- [ ] #1032 behaviour is unchanged: adjacent bullet lists still coalesce, and its regression tests keep passing; existing `web::markdown` tests keep passing.\n- [ ] Regression tests in `pkgs/id/src/web/markdown.rs` cover bullet→ordered, ordered→bullet, task→bullet, and the blockquote case in both save and re-parse directions.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-27T11:09:47Z","url":"https://github.com/developing-today/code/issues/1397"}
| 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:cb233b93-2ae3-6ecf-4f02-4e93507a29ee |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9AC4:395268:D7F3C9:116EBC0:6B0642AF |
| html-safe-nonce | fc6b4ff1ec356c55748c4f67a62fa13821deb25ce3c6cccfb7a5fa9f902eb00a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QUM0OjM5NTI2ODpEN0YzQzk6MTE2RUJDMDo2QjA2NDJBRiIsInZpc2l0b3JfaWQiOiIzOTgyMTcyNDkwODI5ODMwODciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 25e0108f9b159ab6507fcfc039c5093284e00bb3d808f117e8fa02695b647163 |
| hovercard-subject-tag | issue:6058002856 |
| 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/1397/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1a8950f38254acabc13a87947059d52cbcd81415ca68089739f07201384126ff/developing-today/code/issues/1397 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1a8950f38254acabc13a87947059d52cbcd81415ca68089739f07201384126ff/developing-today/code/issues/1397 |
| og:image:alt | Problem In the id web markdown codec (pkgs/id/src/web/markdown.rs), a document where a list is immediately followed by a list of a different type — bullet → ordered, ordered → bullet, or task → bul... |
| 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 | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| 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 | ac613d3698d3d8565651455086e1f74da07bf277 |
| 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