Repository navigation
🐛 Fixed formats spreading onto the next text when one ends inside another - #32355
Conversation
|
No actionable comments were generated in the recent review.
|
…ther no ref When an outer format such as bold ended while an inner one such as italic carried on, the HTML renderer closed the inner tag and left the outer one open. The following text then picked up the outer format in published posts and newsletters, even though the editor showed it correctly. Closing a format now also closes the formats nested inside it, and the next text node re-opens the ones it still has.
no ref Covers highlight, a linebreak between the nodes and a following link, so the closing logic is exercised where the next text node is not adjacent or a link forces every format closed. Also trimmed the closing comment to two lines and dropped the history comment from the new test.
fa85bf8 to
311be41
Compare
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run ghost:test:ci:integration |
✅ Succeeded | 2m 27s | View ↗ |
nx run ghost:test:integration |
✅ Succeeded | 1m 57s | View ↗ |
nx run ghost:test:ci:e2e |
✅ Succeeded | 5m 10s | View ↗ |
nx run ghost:test:e2e |
✅ Succeeded | 3m 56s | View ↗ |
nx run ghost:test:legacy |
✅ Succeeded | 2m 5s | View ↗ |
nx run ghost:test:ci:unit |
✅ Succeeded | 1m 7s | View ↗ |
nx run-many -t test:unit -p @tryghost/kg-lexica... |
✅ Succeeded | 46s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | 24s | View ↗ |
Additional runs (6) |
✅ Succeeded | ... | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-10-30 18:34:16 UTC
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #32355 +/- ##
==========================================
+ Coverage 85.48% 85.60% +0.11%
==========================================
Files 1413 1413
Lines 52924 52924
Branches 9091 9091
==========================================
+ Hits 45244 45304 +60
+ Misses 6565 6493 -72
- Partials 1115 1127 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

no ref
When an outer format ends while an inner one continues, the Lexical HTML renderer closes the inner tag and leaves the outer one open, so the following text picks up a format the author never applied. Typing "Hello world foo", making "Hello world" bold and "world foo" italic renders
<strong>Hello <em>world</em><em> foo</em></strong>, so " foo" is bold in published posts and newsletters while the editor shows it as italic only.For each format the next node lacked, the close step popped the innermost open format instead of the missing one. It now closes the outermost format the next node lacks together with everything nested inside it, and the next node re-opens the formats it still has. The example above now renders
<strong>Hello <em>world</em></strong><em> foo</em>.Ran:
vitest run test/text-formats.test.tsinkoenig/kg-lexical-html-renderer: the 3 new cases fail on main and pass with the fixRan: full package suite with coverage: 70/70 passed, lines 91.12% (gate 90%)
Checked:
tsc --noEmit,eslint,oxlint --deny-warnings,oxfmt --checkandpnpm change checkChecked: no Ghost core snapshot contains the old nesting
I've read and followed the Contributor Guide
I've explained my change
I've written an automated test to prove my change works