fix: HTML export/parse round trip ignoring empty blocks (BLO-873) - #2931
fix: HTML export/parse round trip ignoring empty blocks (BLO-873)#2931matthewlipski wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (6)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe HTML block serializer now preserves empty inline blocks by inserting a non-breaking space when their content DOM is empty. Export coverage adds a case for an empty paragraph between two populated paragraphs. ChangesEmpty inline HTML preservation
Estimated code review effort: 3 (Moderate) | ~15–30 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Summary
This PR fixes empty paragraphs getting dropped when running to round trip of
blocksToHTMLLossy->tryParseHTMLToBlocks. The fix is to add an character to empty blocks' inline content elements when exporting to lossy HTML. This causes the blocks to be parsed instead of ignored without introducing any other changes in behaviour. Markdown export/parse works the same, and the character don't affect rendering the lossy HTML.Closes #986
Rationale
Dropping empty blocks is a loss of information from the original document that I believe is never desirable for consumers. For this reason, Ive also opted to not make this behaviour configurable.
Changes
See above.
Impact
N/A
Testing
Added unit test case and updated existing HTML export snapshots.
Screenshots/Video
N/A
Checklist
Additional Notes
N/A
Summary by CodeRabbit
Bug Fixes
Tests