Skip to content

🐛 fix(markdown): preserve deep emphasis across blocks - #1660

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/markdown-deep-paragraphs-20261106
Nov 7, 2026
Merged

gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/markdown-deep-paragraphs-20261106

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

Converting HTML with deeply nested emphasis around multiple paragraphs could change which text is emphasized when the Markdown was read back. This keeps the formatting attached to each paragraph.

The Markdown serializer now closes deep raw HTML emphasis at a block boundary and reopens it when the next block has content. One open-marker count tracks both raw HTML and Markdown markers.

Nested HTML emphasis spanning paragraph boundaries can lose formatting when
the Markdown output is read back as HTML. Close and reopen deep markers at
each block so the parser sees a complete emphasis run in each paragraph.
@gaborbernat gaborbernat added the bug Something isn't working label Nov 7, 2026
@codspeed

codspeed Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 0.26%

2 warnings

⚠️ 4 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚠️ 4 benchmarks with a significant change ran in a different software environment

Their base and head results were measured with a different OS or toolchain, such as compiler, runtime or library versions, so the changes might come from this difference rather than from the code. Open an affected benchmark to see what changed.

See affected benchmarks

⚡ 1 improved benchmark
❌ 3 (👁 3) regressed benchmarks
✅ 578 untouched benchmarks
⏩ 32 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_feature[shadow-slot-comments] 137.9 µs 111.6 µs +23.59%
👁 test_feature[phone-ucs2-prose] 2.1 ms 2.2 ms -6.54%
👁 test_feature[phone-ucs4-prose] 1.3 ms 1.4 ms -7.63%
👁 test_feature[select-relative-sibling] 41.7 µs 44.1 µs -5.31%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing gaborbernat:fix/markdown-deep-paragraphs-20261106 (05a831c) with main (0da691e)

Open in CodSpeed

Footnotes

  1. 32 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@gaborbernat
gaborbernat merged commit 5a1badc into tox-dev:main Nov 7, 2026
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant