GeezerVison is showing github.com — id(web): PR #1688's table code-span pipe preprocessor also rewrites fenced code blocks — table examples inside a fence gain spurious backslashes · Issue #2362 · developing-today/code
id(web): PR #1688's table code-span pipe preprocessor also rewrites fenced code blocks — table examples inside a fence gain spurious backslashes #2362Descriptionid(web): PR #1688's table code-span pipe preprocessor also rewrites fenced code blocks — a table example inside a fence gains spurious backslashes
Finding
PR #1688 (open, head 3895a266) fixes #1424 by preprocessing the markdown source before comrak parses it: escape_table_code_span_pipes (called from markdown_to_prosemirror, pkgs/id/src/web/markdown.rs:129 on the PR head) scans line by line, treats any line followed by a table delimiter row as a header row and every following line until a blank line as a table body row, and escapes unescaped pipes inside code spans on those lines (escape_table_code_span_pipes, markdown.rs:324-354 on the PR head).
The scanner has no fenced-code-block state. A fenced block that contains a markdown table example — exactly how docs and notes show table syntax — is therefore rewritten as if it were a live table: the header-looking line inside the fence gets its code-span pipes escaped. Comrak then renders the fence's contents verbatim, backslash included, so the code block displays `a\|b` where the author wrote `a|b`. That is silent corruption of literal code content on the parse direction, introduced by a change whose own guard test pins that lines outside tables stay untouched — a fence is the strongest form of "outside a table", and no test in the PR covers it.
Evidence
- PR: fix(id): keep pipes inside code spans from splitting table cells #1688 (OPEN, head
3895a266633a5904a84e3ce42fa0c00510e1384b) — "fix(id): keep pipes inside code spans from splitting table cells" for id(web): a pipe inside an inline code span in a table cell splits the cell on open — code mark destroyed, phantom column, trailing fragment dropped #1424.
- Call site (PR head):
pkgs/id/src/web/markdown.rs:129 — let protected = escape_table_code_span_pipes(&protected); runs on the whole document inside markdown_to_prosemirror.
- Scanner (PR head):
markdown.rs:324-354 — the loop tracks only in_table (set by is_table_delimiter_row, markdown.rs:226) and header_row (next line is a delimiter row); there is no fence (```/~~~) tracking anywhere in the function, and its doc comment claims only "Lines outside tables are returned untouched".
- Contrast with the sibling preprocessor in the same file:
protect_newline_destinations is documented on current main (5a34fa70, markdown.rs:131-138) as "Fenced code blocks are skipped — a destination-shaped string inside a fence is literal text, not a link." The new preprocessor does not follow that house pattern.
- Logic probe (faithful Python port of the PR's three functions, probe dir
hidden_files/probe-pr1688-fence/): input fence
```markdown block containing | a|b | H2 | + delimiter row comes out with the header line rewritten to | a|b | H2 | inside the fence, while a real (unfenced) table gets the same escaping as intended. The fence case is therefore a mis-fire of the table detection, not comrak behaviour.
- The PR's tests (5 new) cover body/header/only-content/one-column/outside-table cases; none puts a table or a delimiter row inside a fenced block. Deduped against open + closed issues: only id(web): a pipe inside an inline code span in a table cell splits the cell on open — code mark destroyed, phantom column, trailing fragment dropped #1424 (open, the origin) matches; it is about live tables and never mentions fences.
Why it matters
Documents in this system routinely contain markdown-about-markdown: docs, specs, and notes that show table syntax inside fences. After this PR lands as written, merely opening such a document in the web editor rewrites its code samples (a spurious \ appears in every code span containing a pipe on a header-looking line, and on body-looking lines after a delimiter-looking line inside the same fence), and a subsequent save persists the corruption. The fix in the PR is otherwise sound — this is a contained gap in the new scanner, cheapest to close before merge while the PR is still open.
Acceptance criteria
Agent: pr-diff-review-b
State: filed
Source PR: #1688 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 29, 2026developing-today commented on Oct 29, 2026 dezren39 commented on Oct 29, 2026 🤖 Agent note · filed
- Agent: pr-diff-review-b
- Session / ID: pr-diff-review-b run 2026-10-29 10:18 CDT (filed this run)
- State: filed — verified against PR fix(id): keep pipes inside code spans from splitting table cells #1688's head
3895a266 by code reading plus a faithful logic port: escape_table_code_span_pipes (pkgs/id/src/web/markdown.rs:324-354 on the PR head, called at :129) tracks in_table/header_row only and has no fenced-code-block state, so a table example inside a fence is rewritten (a|b → a\|b) and comrak renders the spurious backslash verbatim in the code block.
- Finding: PR fix(id): keep pipes inside code spans from splitting table cells #1688's id(web): a pipe inside an inline code span in a table cell splits the cell on open — code mark destroyed, phantom column, trailing fragment dropped #1424 preprocessor mis-fires inside fenced code blocks; the sibling preprocessor
protect_newline_destinations in the same file explicitly skips fences. No other issue covers this; id(web): a pipe inside an inline code span in a table cell splits the cell on open — code mark destroyed, phantom column, trailing fragment dropped #1424 is live tables only.
- Routing: triage packet enqueued to repo-health-code-pilot this run; labels kind/bug, priority/normal, queue/queued, source/pr-diff-review, task/triage, status/needs-triage, app/id, effort/s. Source PR fix(id): keep pipes inside code spans from splitting table cells #1688 also labelled queue/queued (it is itself the work subject — cheapest fixed before merge).
- Links: issue id(web): PR #1688's table code-span pipe preprocessor also rewrites fenced code blocks — table examples inside a fence gain spurious backslashes #2362 · source PR fix(id): keep pipes inside code spans from splitting table cells #1688 · origin issue id(web): a pipe inside an inline code span in a table cell splits the cell on open — code mark destroyed, phantom column, trailing fragment dropped #1424
dezren39 commented on Oct 31, 2026 🤖 Agent note · done (PR opened)
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|