Title: id(web): saving a blockquote that starts with a code block, table or rule inserts two stray blank lines at the top of the quote · Issue #1002 · developing-today/code · GitHub
Open Graph Title: id(web): saving a blockquote that starts with a code block, table or rule inserts two stray blank lines at the top of the quote · Issue #1002 · developing-today/code
X Title: id(web): saving a blockquote that starts with a code block, table or rule inserts two stray blank lines at the top of the quote · Issue #1002 · developing-today/code
Description: Bug In the id web editor's markdown ↔ ProseMirror codec (pkgs/id/src/web/markdown.rs), saving a document whose blockquote starts with a non-paragraph block (a fenced code block, a table, or a thematic break) inserts two stray blank lines...
Open Graph Description: Bug In the id web editor's markdown ↔ ProseMirror codec (pkgs/id/src/web/markdown.rs), saving a document whose blockquote starts with a non-paragraph block (a fenced code block, a table, or a thema...
X Description: Bug In the id web editor's markdown ↔ ProseMirror codec (pkgs/id/src/web/markdown.rs), saving a document whose blockquote starts with a non-paragraph block (a fenced code block, a table, or a t...
Opengraph URL: https://github.com/developing-today/code/issues/1002
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(web): saving a blockquote that starts with a code block, table or rule inserts two stray blank lines at the top of the quote","articleBody":"## Bug\n\nIn the id web editor's markdown ↔ ProseMirror codec (`pkgs/id/src/web/markdown.rs`), saving a document whose **blockquote starts with a non-paragraph block** (a fenced code block, a table, or a thematic break) inserts **two stray blank lines** — `> ` lines — at the top of the quote, before that first block:\n\nInput:\n\n```markdown\n> ```rust\n> let x = 1;\n> ```\n```\n\nAfter one load/save round trip:\n\n```markdown\n> \n> \n> ```rust\n> let x = 1;\n> ```\n```\n\nThe ProseMirror document is correct throughout (the blockquote contains exactly one `code_block`, no empty paragraphs) and the output is a stable fixpoint — the two lines appear on the first save and stay. But every affected file gets polluted on save, the quote renders with a gap at the top in other renderers, and the diff noise obscures real edits.\n\n## Verified repro (this run, main 3b9d1592)\n\nStandalone verbatim-codec probe crate (evidence log: goal `hidden_files/probe-2026-10-26-1415/out3.log`, probe source is current `markdown.rs` verbatim):\n\n- `markdown_to_prosemirror(\"> ```rust\\n> let x = 1;\\n> ```\\n\")` → `{\"type\":\"blockquote\",\"content\":[{\"type\":\"code_block\",\"attrs\":{\"params\":\"rust\"}, …}]}` — correct, no empty paragraphs.\n- `prosemirror_to_markdown` of that document → `\"> \\n> \\n> ```rust\\n> let x = 1;\\n> ```\\n\"` — two leading blank quote lines.\n- Same pattern for a table as first block (`> | a |…` → two leading `> ` lines) and a thematic break first (`> ---\\n> text` → two leading `> ` lines, plus the normal separator before `text`).\n- Controls that save cleanly: blockquote starting with a paragraph, a heading, or a list; a blockquote where the same code block is *not* first (`> intro` + fence) saves with exactly the one normal separator line.\n- Control isolating the layer: comrak's own parse → `format_commonmark` render of the original input produces the same two blank lines, so the quirk is in the comrak CommonMark renderer behaviour the codec's save direction relies on (`prosemirror_to_markdown`, markdown.rs:868-874, serializes a hand-built AST with `format_commonmark`) — the codec inherits it on every save even though its own AST is correct.\n\nNot #954: that issue is no-info code blocks being rewritten as indented blocks (document-level). This one is about leading blank lines inside a blockquote, affects info-string fences, tables and thematic breaks, and also appears when the block is not first in the file but first in the quote.\n\n## Why it matters\n\nSilent file pollution on save, in the same codec family as #982/#954/#981 but a distinct mechanism: quoted code snippets, quoted tables and quoted rules are common in notes/docs, and the first save of any such file rewrites its top-of-quote for no reason.\n\n## Suggested fix\n\nIn the save direction, stop the two spurious separator lines from reaching the file — e.g. investigate whether the hand-built AST is missing something the renderer keys on for a blockquote's first child (in which case fix `json_to_ast`'s `blockquote`/`code_block` construction), or post-process the serialized output to collapse a blockquote's leading blank `> ` lines (only at quote start — blank separators *between* blocks in a quote are required and must be kept, cf. the `> intro` + fence control). If the behaviour turns out to be unfixable without forking the renderer, record that and close with the rationale rather than leaving it untracked.\n\n## Acceptance criteria\n\n- Round-trip tests: blockquote starting with (a) a fenced code block with an info string, (b) a table, (c) a thematic break followed by text — each saves byte-identical to its input (no leading `> ` lines).\n- Regression controls unchanged: blockquote starting with paragraph/heading/list, and paragraph-then-fence inside a quote (exactly one separator blank line), still round-trip as today.\n- Existing `web::markdown` tests pass.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-26T19:17:57Z","url":"https://github.com/developing-today/code/issues/1002"}
| 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:dcd559fc-7a43-d392-f301-6b34c314345b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CCA2:C35D8:91AC4D:BEA9DE:6B06336B |
| html-safe-nonce | e374bd96cba2658e20965b16bdf5cfcf74ba4a4317fc16eec5505c497aa2c6f5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQ0EyOkMzNUQ4OjkxQUM0RDpCRUE5REU6NkIwNjMzNkIiLCJ2aXNpdG9yX2lkIjoiNjMwMjU5NjY3NDUxNDk4OTkzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 808d3f08c8e0dd712a4aaa1076b60c403841b12a1178a0d77c2756ecc1cad5e4 |
| hovercard-subject-tag | issue:6046544772 |
| 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/1002/issue_layout |
| twitter:image | https://opengraph.githubassets.com/545d7c76bb6b657b2a7cf0b0d904a58acbda7e9c1816bf603ee21f3a2948b1d6/developing-today/code/issues/1002 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/545d7c76bb6b657b2a7cf0b0d904a58acbda7e9c1816bf603ee21f3a2948b1d6/developing-today/code/issues/1002 |
| og:image:alt | Bug In the id web editor's markdown ↔ ProseMirror codec (pkgs/id/src/web/markdown.rs), saving a document whose blockquote starts with a non-paragraph block (a fenced code block, a table, or a thema... |
| 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 | c3584c853cd39700ecff6e2cf8364295ffdb5313e571046c41cd2479270f7df0 |
| 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 | 9eb3bb1597d09170a5f282cd38ae376dee1a5ec1 |
| 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