microsoft / microsoft/markitdown

HTML/DOCX: pipe characters in table cells break Markdown tables

Open Beginner friendly
#2,438 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.