Title: id(web): fenced code blocks without an info string are rewritten as indented blocks on save · Issue #954 · developing-today/code · GitHub
Open Graph Title: id(web): fenced code blocks without an info string are rewritten as indented blocks on save · Issue #954 · developing-today/code
X Title: id(web): fenced code blocks without an info string are rewritten as indented blocks on save · Issue #954 · developing-today/code
Description: Problem In the id web editor's markdown codec (pkgs/id/src/web/markdown.rs), a fenced code block without an info string is rewritten as an indented (4-space) code block on save. The user's chosen fence form is destroyed on every open→sav...
Open Graph Description: Problem In the id web editor's markdown codec (pkgs/id/src/web/markdown.rs), a fenced code block without an info string is rewritten as an indented (4-space) code block on save. The user's chosen f...
X Description: Problem In the id web editor's markdown codec (pkgs/id/src/web/markdown.rs), a fenced code block without an info string is rewritten as an indented (4-space) code block on save. The user's ...
Opengraph URL: https://github.com/developing-today/code/issues/954
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(web): fenced code blocks without an info string are rewritten as indented blocks on save","articleBody":"## Problem\n\nIn the id web editor's markdown codec (`pkgs/id/src/web/markdown.rs`), a fenced code block **without an info string** is rewritten as an indented (4-space) code block on save. The user's chosen fence form is destroyed on every open→save, even when nothing else changed. An empty fenced block additionally gains a spurious blank line.\n\n## Evidence (verified this run)\n\nRound-trip probe on main `a2eef6f7` (standalone crate compiling the verbatim `pkgs/id/src/web/markdown.rs` against comrak 0.56.0 + serde_json; full logs in the goal's `hidden_files/probe-2026-10-26-0312/out.log` and `out3.log`):\n\n| Input | Saved output |\n|---|---|\n| ` ``` ` block with blank lines, no info (`` ```\\nline1\\n\\n\\nline2\\n``` ``) | indented block: ` line1\\n \\n \\n line2` |\n| ` ```` ` block containing a ``` line (no info) | indented block: ` ```\\n inner` |\n| fenced block (no info) inside a list item | rewritten to a 6-space indented block inside the item |\n| fenced block (no info) inside a blockquote | rewritten to indented form (`> code line`) |\n| empty fenced block (` ```\\n``` `) | ` ```\\n\\n``` ` — a blank content line appears |\n| ` ```rust ` block with blanks (control, has info) | stays fenced, unchanged ✓ |\n\nThe rewritten forms are currently stable fixpoints (a second round-trip does not degrade them further), so this is a fidelity/diff-noise bug rather than progressive corruption — but the rewrite is unconditional: merely opening and saving a note reformats every info-less fenced block in it.\n\n## Root cause (to confirm in triage)\n\n`json_to_ast` builds every `code_block` as `fenced: true, fence_length: 3` (`pkgs/id/src/web/markdown.rs:885-890`), yet comrak's `format_commonmark` renderer still emits the indented form for these blocks — the cases above suggest it does so whenever there is no info string (the `rust`-info control stays fenced). Separately, the literal is always built as `format!(\"{content}\\n\")` (:890), so an empty block's literal is a single `\"\\n\"`, which renders as the spurious blank line. The existing round-trip test (`test_roundtrip_code_block`) only covers an info-carrying block, so neither behavior is pinned.\n\n## Why it matters\n\n- Silent reformatting on save pollutes diffs in synced/vault notes and erodes trust in the editor's other (correct) round-trips.\n- Indented code is context-fragile once the user edits the saved file by hand or in another tool: it cannot interrupt a paragraph, is invisible as a block, and is the form most likely to be mangled by other markdown tooling.\n- Info-less fences are the common case for plain shell/output snippets.\n\n## Acceptance criteria\n\n- A fenced code block without an info string round-trips open→save still fenced (byte-identical modulo the file's trailing newline), including blocks with blank lines, blocks containing ``` lines, and blocks nested in list items and blockquotes.\n- An empty fenced block round-trips with no spurious blank line added.\n- Info-carrying blocks and all existing codec tests are unchanged; new unit tests in `pkgs/id/src/web/markdown.rs` cover the info-less and empty cases.\n- Saved output is a stable fixpoint on a second round-trip.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-26T08:28:00Z","url":"https://github.com/developing-today/code/issues/954"}
| 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:3090daba-da15-e754-b3cd-ab7b53a1d51e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B470:3F83D3:C50B51:FF07FF:6B063F04 |
| html-safe-nonce | 684b661de4c60f4f45f8279e63541d6e877ed87dbbe94ffc59a1a14f8fee67f1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDcwOjNGODNEMzpDNTBCNTE6RkYwN0ZGOjZCMDYzRjA0IiwidmlzaXRvcl9pZCI6IjY3MTY5OTE2NzYzMzE5OTg5ODAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ab58cff43ce8f801a35566e183c4067d0c33a71dc21d080c9ed3af236586bf1a |
| hovercard-subject-tag | issue:6036072463 |
| 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/954/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1f92f505b9a9364292f0d29c559c39252534011625e7f56d398b9bf364053d58/developing-today/code/issues/954 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1f92f505b9a9364292f0d29c559c39252534011625e7f56d398b9bf364053d58/developing-today/code/issues/954 |
| og:image:alt | Problem In the id web editor's markdown codec (pkgs/id/src/web/markdown.rs), a fenced code block without an info string is rewritten as an indented (4-space) code block on save. The user's chosen f... |
| 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 | dcf72c457c022486d23c3cbb0dd21aba537a87611ca9ddabd1799cf2eaa9b297 |
| 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 | 0f38f5735226749ec5e08a8649dce4cb2613d9ad |
| 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