Repository navigation
test(html): pin physical paragraph borders on right-to-left paragraphs (#1154) - #1162
Merged
Merged
Conversation
#1154) The standard says a paragraph's left border is drawn on the left of the page whatever the paragraph's direction, and LibreOffice draws it there. Docxodus already did; pin it with tests that fail if the borders mirror, and record the finding in the corner-case notes.
This was referenced Oct 16, 2026
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 #1154
Second of a three-PR stack: #1161 (#1153), then this one, then #1155's PR. It is based on #1161's branch and will be retargeted to
mainwhen #1161 merges.Why
#1147 mirrored the indents of right-to-left (
w:bidi) bordered paragraphs, because Word readsw:ind'sw:left/w:righton such a paragraph as start/end. The issue asked whetherw:pBdr'sw:left/w:rightshould be mirrored the same way, and said to verify before changing anything.What I found
They should not be mirrored, and Docxodus already draws them correctly, so this PR changes no behaviour.
LeftBorderandRightBorderremarks, says the left paragraph border "shall be displayed on the left side of the page around the specified paragraph. This shall not change based on the paragraph direction". It says the same of the right border. The only swap it documents is thew:swapBordersFacingPagescompatibility setting, which applies on odd-numbered pages of documents that also use mirrored margins and different even/odd headers.w:left, a thin singlew:right,w:bidi,start=1440 end=360) with the double border on the left and the start indent mirrored to the right.What changes
RightToLeftParagraphBorderTestspin the behaviour. The borders keep their physical sides in both directions, and in a mirrored box each margin subtracts the width and spacing of the border physically on that side. A mutation that mirrors the borders for bidi paragraphs fails two of them.CreateBorderDivssays why the sides are physical.docs/ooxml_corner_cases.mdrecords the spec text, the reproducer, and a spec / LibreOffice / Docxodus / Word table.Adversarial review
One round of hostile review ran before opening. It confirmed the spec quote and the LibreOffice render independently, and it checked that the tests fail if the borders are mirrored. Its two doc nits are fixed in the second commit. The table had said the spec was silent on
w:right, but theRightBorderremarks say the same thing. The paraphrase of the facing-pages condition is replaced with the spec's actual conditions.