Repository navigation
fix(docx): preserve Heading 7-9 styles by clamping to h6 (#2530) - #2630
Open
İlker Oğulcan SAYIN (iosayin) wants to merge 1 commit into
Open
İlker Oğulcan SAYIN (iosayin) wants to merge 1 commit into
İlker Oğulcan SAYIN (iosayin) wants to merge 1 commit into
Conversation
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.
Closes #2530
Summary
Word defines Heading styles 1 through 9, but Mammoth's default style map only maps
Heading 1throughHeading 6. Paragraphs styled withHeading 7,Heading 8, orHeading 9were previously dropped into plain<p>paragraphs, losing their document structure entirely.Since Markdown only supports heading levels up to 6 (
######), this PR maps Heading 7, 8, and 9 toh6:fresh(equivalent to######), preserving the heading semantics and document hierarchy.Changes
_HEADING_STYLE_MAPin_docx_converter.pymappingHeading7-Heading9andHeading 7-Heading 9toh6:fresh.tests/test_docx.pyasserting that Heading 7, 8, and 9 are preserved as######.