Repository navigation
fix(frontend): preserve code during Markdown table normalization - #3981
Draft
cangen185-sudo wants to merge 1 commit into
Draft
cangen185-sudo wants to merge 1 commit into
cangen185-sudo wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The document chunk preview runs
normalizeSpuriousTablePrefixes()beforemarked.parse(). It currently repairs pipe-delimited rows even inside literal Markdown code blocks. A fenced table example gains an extra separator row; examples of MarkItDown's empty-prefix output lose their first two rows. Four-space/tab-indented code can also be changed.Limit table repair to non-code rows and track backtick/tilde fences, including the same-character/minimum-length closing rule, indentation, unterminated fences and backticks in info strings. No dependencies or public APIs change. Ordinary MarkItDown tables keep their existing repair behavior.
Type of Change
Related Issue
New locally reproduced defect. This does not address #3962; that single-tilde rendering issue already has #3963.
Testing
Baseline:
bccb4b151bae403508da77fbb174efc79dc47c1a(main). Windows, Node.js 24.16.0.npm test -- src/utils/markdownTableNormalize.test.ts src/utils/documentPreviewMarkdown.test.ts src/utils/chatMarkdownRenderer.test.ts: 59 passed.npm ci --ignore-scripts --no-audit --no-fund: passed; package-lock unchanged.npm run type-check: passed.git diff --check: passed.No live backend/model or full-repository suite was run. The tests cover this preprocessing function and adjacent Markdown renderers. This is a targeted fence guard, not a full Markdown parser or an overhaul of table recognition.
Checklist
Screenshots / Recordings
The defect can be reproduced without a server using this input:
Before: the rendered code gains
| --- | --- |between its two rows. After: both literal rows are unchanged. The dedicated tests assert exact source preservation. No CSS/layout changes are made.AI assistance
Codex assisted with source audit, reproduction, implementation and local tests. This PR is submitted as a draft for contributor review; no human review or maintainer acceptance is claimed.