Fix DOCX: clamp Heading 7-9 styles to h6 instead of dropping heading structure by dajiaohuang · Pull Request #2660 · microsoft/markitdown · GitHub
Skip to content

Fix DOCX: clamp Heading 7-9 styles to h6 instead of dropping heading structure - #2660

Open
Wu Shuwen (dajiaohuang) wants to merge 1 commit into
microsoft:mainfrom
dajiaohuang:fix/docx-heading-7-9-clamp
Open

Wu Shuwen (dajiaohuang) wants to merge 1 commit into
microsoft:mainfrom
dajiaohuang:fix/docx-heading-7-9-clamp

Conversation

@dajiaohuang

@dajiaohuang Wu Shuwen (dajiaohuang) commented Oct 7, 2026 •

Copy link
Copy Markdown

Fixes #2530.

Mammoth's default style map only maps Word Heading 1-6 to HTML h1-h6. Heading 7, 8, and 9 came through as plain <p> text, silently losing their heading structure. Markdown has no heading level past 6, so clamp Heading 7-9 to h6 (######) via a default style_map entry.

Focused validation (2026-10-15)

Generated a native DOCX Heading 7 paragraph and converted it through MarkItDown.convert_stream. Main loses heading structure; this unchanged head emits a level-6 Markdown heading. No full-suite/current-head CI success is claimed. Existing dependencies were reused without installation; maintainer acceptance remains pending.

…structure

Fixes microsoft#2530.

Mammoth's default style map only maps Word Heading 1-6 to HTML h1-h6.
Heading 7, 8, and 9 came through as plain <p> text, silently losing their
heading structure. Markdown has no heading level past 6, so clamp Heading
7-9 to h6 (######) via a default style_map entry, matching the
recommendation in the issue.
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.

DOCX: Heading 7-9 styles lose heading structure entirely (render as plain paragraphs)

1 participant