fix(converter): skip footnoteRef/endnoteRef runs to prevent empty spans#89
Merged
fix(converter): skip footnoteRef/endnoteRef runs to prevent empty spans#89
Conversation
When rendering footnotes/endnotes, Word documents contain runs with w:footnoteRef or w:endnoteRef elements that display the note number inside the note text. Since we add note numbers separately (via footnote-number span in paginated mode or <ol> value in non-paginated mode), these runs produced empty styled spans causing whitespace issues. This fix detects runs containing only w:footnoteRef or w:endnoteRef and returns null, preventing the creation of empty spans in the HTML output. - Add check in ConvertRun() to skip footnoteRef/endnoteRef-only runs - Add tests for both paginated and non-paginated footnote rendering
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.
Summary
w:footnoteReforw:endnoteRefare now skipped inConvertRun()Problem
When rendering footnotes/endnotes to HTML, Word documents contain runs with
w:footnoteReforw:endnoteRefelements that Word uses to display the note number inside the note text. Since we add note numbers separately (viafootnote-numberspan in paginated mode or<ol>value attribute in non-paginated mode), these runs produced empty styled spans causing:xml:space="preserve"affecting layoutSolution
Added detection in
ConvertRun()to identify runs that only containw:footnoteReforw:endnoteRef(plus optionalw:rPr) and returnnullfor them, preventing empty span generation.Test plan
HC008b_FootnoteContent_NoEmptySpansFromFootnoteReftest for non-paginated modeHC008c_FootnoteContent_PaginatedMode_NoEmptySpansFromFootnoteReftest for paginated mode