Skip to content

fix(docreader): preserve header separators in captioned HTML tables - #6239

Open
Yzzz88 wants to merge 2 commits into
Tencent:mainfrom
Yzzz88:fix/html-caption-table-header
Open

Yzzz88 wants to merge 2 commits into
Tencent:mainfrom
Yzzz88:fix/html-caption-table-header

Conversation

@Yzzz88

@Yzzz88 Yzzz88 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Description

An HTML financial/report table with a caption loses the Markdown header separator during conversion. For example, a captioned Area/Amount table becomes consecutive pipe-delimited text lines with no | --- | --- | row, so Markdown rendering and table-aware chunking no longer recognize a table.

Move each caption to a paragraph immediately before its own table before markdownify runs. This retains the caption's text/formatting and lets the first table row receive its normal header separator. The shared converter serves uploaded HTML and MHTML archives.

Testing

Two regressions failed on current main with the separator missing. Four new cases and nine existing inline-image/table-footer cases pass (13 total), exercising direct conversion, uploaded HTML, archived HTML, uncaptioned tables, cell images, and footer order. markdownify 1.2.0 matches the lockfile.

Local tests use an isolated parser loader to skip unrelated Office/PDF registry imports. The full existing HTML registry suite could not import in this minimal environment because textract is absent; it is not claimed as passing. No backend service or full docreader suite was run. Python compilation and git diff --check pass.

This branch has not been deployed

No deployments
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