fix: escape pipe characters in CSV table cells#2066
Open
zekiyemeral wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Add Markdown safety when converting CSV content to Markdown tables by escaping pipe characters.
Changes:
- Introduced a helper to escape
|characters in table cells. - Applied escaping to header and data rows during Markdown table generation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
92
to
+93
| return DocumentConverterResult(markdown=result) | ||
|
No newline at end of file |
Author
|
@microsoft-github-policy-service agree |
|
The solution looks good from pipes, but I think we should also considers, rogue newlines and carriage returns which can easily be introduced into the files breaking the table structure. check my PR for the same issue #2061 and lmk what you think. |
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.
Summary
This pull request fixes a Markdown table formatting issue in
CsvConverter.When a CSV cell contains a literal pipe character (
|), the generated Markdown table can be parsed incorrectly because the pipe is treated as a column separator. This change escapes pipe characters inside CSV cell values before joining them into Markdown table rows.Changes
|characters in Markdown table cells.Why This Matters
CSV files may contain pipe characters in formulas, command examples, regular expressions, SQL snippets, and other real-world data. Without escaping, the generated Markdown output can become structurally incorrect.
Closes #2019