GeezerVison is showing github.com — id(web): fenced code blocks without an info string are rewritten as indented blocks on save · Issue #954 · developing-today/code
id(web): fenced code blocks without an info string are rewritten as indented blocks on save #954Labels app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)mode/onlineFully doable remotely: design, config, code, cloudpriority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests DescriptionProblem
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→save, even when nothing else changed. An empty fenced block additionally gains a spurious blank line.
Evidence (verified this run)
Round-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):
| Input |
Saved output |
``` block with blank lines, no info (```\nline1\n\n\nline2\n```) |
indented block: line1\n \n \n line2 |
```` block containing a ``` line (no info) |
indented block: ```\n inner |
| fenced block (no info) inside a list item |
rewritten to a 6-space indented block inside the item |
| fenced block (no info) inside a blockquote |
rewritten to indented form (> code line) |
empty fenced block (```\n```) |
```\n\n``` — a blank content line appears |
```rust block with blanks (control, has info) |
stays fenced, unchanged ✓ |
The 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.
Root cause (to confirm in triage)
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.
Why it matters
- Silent reformatting on save pollutes diffs in synced/vault notes and erodes trust in the editor's other (correct) round-trips.
- 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.
- Info-less fences are the common case for plain shell/output snippets.
Acceptance criteria
- 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.
- An empty fenced block round-trips with no spurious blank line added.
- 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.
- Saved output is a stable fixpoint on a second round-trip.
Activityadded kind/bugSomething isn't working (prefixed form of the classic bug label) task/triageQueue packet kind: verify, reproduce, and route this item app/idPackage/app: id (pkgs/ or apps/ in this repo) on Oct 26, 2026dezren39 commented on Oct 26, 2026 🤖 Agent note · state: filed
- Agent: new-issue-creator job
- Session / ID: new-issue-creator run 2026-10-26T08:28Z (scheduled 03:15 CDT)
- Found via: filed this run
- Task: Filed after a verified round-trip probe (standalone crate, verbatim markdown.rs, comrak 0.56.0) showed info-less fenced code blocks rewritten as indented blocks on save (and empty blocks gaining a blank line); queued as a triage packet — the comrak renderer mechanism needs confirming before a fix shape is chosen.
- Expectation: effort/s — done when the acceptance criteria in the issue body pass with new codec unit tests.
- Links: probe logs in goal hidden_files/probe-2026-10-26-0312/out.log and out3.log
dezren39 commented on Oct 27, 2026 🤖 Agent note · filed
- Agent: new-issue-creator job
- Session / ID: new-issue-creator cron run 2026-10-26 19:45 CDT
- Found via: filed this run (evidence added to this existing issue instead of a duplicate filing)
- Task: New probe evidence for this issue: the "stable fixpoint" claim in the body does NOT hold when one list item contains TWO info-less fenced code blocks. Verified on main 70efcd4 (probe logs hidden_files/probe-2026-10-26-1945/out3.log, case bullet_two_code): orig
- item + two blocks ("code", "more") → save 1 renders both as one indented region (` code\n\n more`) → re-parse yields a SINGLE code_block with literal `code\n\nmore` (PM2 inspected) → save 2 is that merged block. Block count changes 2 → 1: progressive corruption, not just fence-form fidelity. Therust control (bullet_two_code_info) keeps both blocks separate and is a fixpoint. Suggest adding "two adjacent info-less blocks in one list item stay two blocks" to this issue's acceptance criteria.
- Expectation: whoever fixes id(web): fenced code blocks without an info string are rewritten as indented blocks on save #954 includes the two-block list-item case in the regression tests.
- Links: related new filing id(web): loose task list items fuse on save — task_list hardcodes tight, second paragraph/code block destroyed #1036 (task-list tightness, distinct code path)
dezren39 commented on Nov 2, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 2, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 10, 2026
🤖 Agent note · triaged
- Agent: triage-step
- State: triaged
- Verdict: work kind
task/small-fix · priority/low · effort/s · kind/bug
- Priority why: priority/low — brief line 5: fidelity/diff-noise bug, no data loss or fleet impact; useful when convenient.
- First step: In pkgs/id/src/web/markdown.rs, confirm why comrak emits the indented form for info-less fenced blocks (json_to_ast at :885-890) and make info-less blocks round-trip as fenced; fix the empty-block literal that adds a blank line.
- Acceptance: Round-trip tests pin info-less fenced blocks (including in lists/blockquotes and the empty-block case) staying fenced with no spurious blank line, and the existing info-carrying control still passes.
- Fix packet:
repo-health:v1:fix:developing-today/code:issue:954 → queue repo-health-code-pilot, task 14530.
dezren39 commented on Nov 10, 2026 🤖 Agent note · done (triaged, per runbook §1c / #8097 rule 3)
dezren39 commented on Nov 10, 2026 agent-note:v1
lane: code-w
task: 14530
issue: #954
stage: claimed
note: Task 14530 (small_fix, issue #954) picked up by lane code-w (direct, lane row 5991). Fresh check: issue #954 OPEN, no hard-stop labels, no status/needs-triage. Work: fix pkgs/id/src/web/markdown.rs so info-less fenced code blocks round-trip fenced (incl. blank lines, nested fences, list/blockquote nesting) and empty fenced blocks gain no spurious blank line; add unit tests. Next: create laptop worktree, inspect codec, reproduce. dezren39 commented on Nov 10, 2026 agent-note:v1
lane: code-w
task: 14530
issue: #954
stage: done
note: Task 14530 (small_fix, issue #954) verified already fixed on main by lane code-w (direct, lane row 5991); closing this issue on that evidence. The fix is present in pkgs/id/src/web/markdown.rs on main e94cf89: render option prefer_fenced forces the fenced spelling for info-less code blocks, json_to_ast builds an empty literal for empty blocks (no spurious blank line), and force_fenced_code_blocks_in_blockquotes covers the blockquote shape (landed via repo-keeper snapshot 7fb1e6d and commit 1ec98d8 for #1496). Verification run on the laptop this shift (cargo test --manifest-path pkgs/id/Cargo.toml --features web --lib, stub dist/ placeholder for RustEmbed): test_roundtrip_info_less_code_block_stays_fenced ok, test_roundtrip_empty_code_block_has_no_spurious_blank_line ok, test_roundtrip_code_block ok, test_info_less_code_block_keeps_following_paragraph_in_blockquote ok; full web::markdown module 266 passed, 0 failed. Every acceptance case (blank lines, fence-containing content, list item, blockquote, empty block, fixpoint) is pinned by those tests. No code change was needed from this task.
MetadataMetadataapp/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)mode/onlineFully doable remotely: design, config, code, cloudpriority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests DevelopmentNo branches or pull requestsIssue actions
|