fix(docx): clamp Word Heading 7-9 to markdown h6 - #2531
Closed
Manohar Paturi (ManoharPaturi) wants to merge 2 commits into
Closed
Manohar Paturi (ManoharPaturi) wants to merge 2 commits into
Manohar Paturi (ManoharPaturi) wants to merge 2 commits into
Conversation
MarkItDown._convert applied its whitespace cleanup (rstrip every line, collapse 3+ newlines to 2) to the entire converted document, which corrupted fenced code blocks: blank-line runs inside a fence collapsed and trailing spaces were stripped, changing code content. Track code fences while normalizing and leave their contents untouched. Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
mammoth's default style map stops at Heading 6, so Word's deeper heading styles came through as plain paragraphs and their structure was dropped. Add style-map entries mapping Heading 7/8/9 to h6, the deepest level markdown supports. Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
Author
|
XU (@kokokoXUY) same stacking issue here as on #2533, rebuilt from current main so the diff is only the docx heading clamp and its test (4121d96, single commit). the whitespace and xlsx changes live in their own PRs. |
Manohar Paturi (ManoharPaturi)
deleted the
fix/docx-deep-heading-levels
branch
September 25, 2026 16:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2530.
Adds style-map entries so Word Heading 7/8/9 clamp to markdown h6 instead of rendering as plain paragraphs. One regression test covering levels 1-9 (fails on main where 7-9 lose their heading).