microsoft / microsoft/markitdown
HTML/DOCX: pipe characters in table cells break Markdown tables
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 186k
- Forks
- 13.7k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 49
Description
A literal pipe in an HTML table cell is data, not a column separator, but it is passed through untouched, so the rendered row gains phantom columns. DOCX tables are affected too since they convert via the HTML converter.
Repro:
import io
from markitdown import MarkItDown
html = (
'<table><thead><tr><th>Name</th><th>Note</th></tr></thead>'
'<tbody><tr><td>Alice</td><td>Has a | pipe</td></tr></tbody></table>'
)
print(MarkItDown().convert_stream(
io.BytesIO(html.encode()), file_extension='.html').markdown)
# Before: | Alice | Has a | pipe | (3 columns, broken)
# After: | Alice | Has a \| pipe | (2 columns, correct)
Same class as the CSV (#2266) and XLSX (#2436) pipe bugs, but in the shared HTML layer (_CustomMarkdownify), which neither of those covers. Searched open and closed issues/PRs: no report or fix for HTML/DOCX table pipes (open #1785 covers PPTX only, via pre-escaping).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the shared HTML layer, _CustomMarkdownify, and reproduce the supplied MarkItDown().convert_stream example to trace how table-cell text reaches Markdown. Done means literal pipes in HTML-derived table cells are escaped so the example renders two columns, with the same behavior preserved for DOCX tables that use the HTML converter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 78/100