Skip to content

fix: escape pipes in HTML-derived table cells - #2823

Open
Dheeraj Piduru (DheerajPiduru52) wants to merge 1 commit into
microsoft:mainfrom
DheerajPiduru52:fix/escape-pipes-in-table-cells
Open

Dheeraj Piduru (DheerajPiduru52) wants to merge 1 commit into
microsoft:mainfrom
DheerajPiduru52:fix/escape-pipes-in-table-cells

Conversation

@DheerajPiduru52

Copy link
Copy Markdown

Pipes inside / text were emitted verbatim, so a cell such as 'a|b' split into an extra column and corrupted the Markdown table. HTML, XLSX, XLS and DOCX tables all go through _CustomMarkdownify, so all of them were affected; the CSV converter already escapes pipes.

Escape pipes (doubling any preceding backslash run) in convert_td and convert_th, mirroring the CSV converter.

Repro: an XLSX with a cell a|b produces | a|b | c | (3 columns under a 2-column header). Adds HTML and XLSX regression tests that fail without the fix and pass with it.

@DheerajPiduru52

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Pipes inside <td>/<th> text were emitted verbatim, so a cell such as
'a|b' split into an extra column and corrupted the Markdown table.
HTML, XLSX, XLS and DOCX tables all go through _CustomMarkdownify, so
all of them were affected; the CSV converter already escapes pipes.

Escape pipes (doubling any preceding backslash run) in convert_td and
convert_th, mirroring the CSV converter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant