Skip to content

fix(docx): preserve Heading 7-9 as h6 headings (#2530) - #2650

Open
İlker Oğulcan SAYIN (iosayin) wants to merge 1 commit into
microsoft:mainfrom
iosayin:fix/docx-heading-7-9-mapping
Open

İlker Oğulcan SAYIN (iosayin) wants to merge 1 commit into
microsoft:mainfrom
iosayin:fix/docx-heading-7-9-mapping

Conversation

@iosayin

Copy link
Copy Markdown

Resolves #2530

Summary of Changes

  • Mammoth's default style map only includes Heading 1 through 6, causing Word paragraphs styled as Heading 7, Heading 8, or Heading 9 to degrade to plain <p> paragraphs, losing their heading semantics completely.
  • Added _HEADING_STYLE_MAP to _docx_converter.py mapping Word's Heading 7, Heading 8, and Heading 9 (both style ID and style name variations) to h6:fresh, correctly clamping to markdown's deepest supported level (######).
  • Added a full end-to-end unit test (test_convert_docx_heading_7_to_9) verifying that Headings 7, 8, and 9 correctly convert to ###### headings.

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