Implement pipe character escaping in CSV converter#2074
Conversation
Added a method to escape pipe characters in CSV cells for Markdown tables.
noezhiya-dot
left a comment
There was a problem hiding this comment.
Simple, correct fix. Pipe characters in CSV cells break Markdown table rendering because | is the column delimiter. Escaping them with | is the standard approach.
The implementation is clean:
- Dedicated _escape_pipe method keeps it DRY
- Applied consistently to header, data rows, and padding rows
- No edge cases missed — empty cells pass through harmlessly
This is a common enough issue in real-world CSV data (product specs, names with pipes, etc.) that this fix will prevent a lot of broken tables. LGTM.
|
Why am I getting these? |
|
Simple and correct fix for the pipe-escaping issue in CSV-to-Markdown conversion. The One suggestion: consider also handling newlines within cells. A cell containing Also, the Otherwise, good to merge. |
noezhiya-dot
left a comment
There was a problem hiding this comment.
Code Review: Implement pipe character escaping in CSV converter
Good catch - unescaped pipe characters in CSV cells will break Markdown table rendering.
Strengths
- Simple, focused fix with a dedicated _escape_pipe method.
- Applied consistently to both header and data rows.
- Clear problem statement in the PR description.
Suggestions
-
Markdown escaping completeness: Pipe is not the only character that can break Markdown tables. Newlines (\n) within cells also break table rendering (Markdown tables require cells to be single-line). Consider also replacing newlines with
or spaces for completeness. -
Backslash escaping: The current approach escapes | as |. In some Markdown renderers, the backslash itself may be visible in the output. An alternative is to use the HTML entity | which is more universally handled. That said, | is the standard Markdown escape and should work in most renderers (GitHub, CommonMark). This is a minor preference, not a blocker.
-
Test coverage: The PR does not include tests. A simple test case with pipe characters in cells would prevent regressions.
Approved - this fixes a real bug that produces broken Markdown output.
Tests also Updated.Simple and correct fix for the pipe-escaping issue in CSV-to-Markdown conversion. |
Added a method to escape pipe characters in CSV cells for Markdown tables.
When CSV files contain pipe characters ( | ) in their cell values, the CsvConverter produces broken Markdown tables because pipe characters are table delimiters in Markdown syntax.
Example Problem:
Code
Input CSV:
name, description
John|Doe,Developer|Engineer
Alice, #@manager|Lead
Current Output (BROKEN):
This breaks the Markdown table structure!