Repository navigation
🐛 fix(markdown): keep edge spaces in inline code - #1238
Merged
gaborbernat merged 1 commit intoOct 8, 2026
Merged
Conversation
A reader strips one space from each end of code span content that starts and ends with one (CommonMark 6.1), so <code> a </code> between two words read back as "a" and fused the words. Such content now gets one more space on each side, as content edged by a backtick already did.
gaborbernat
force-pushed
the
fix/markdown-code-span-spaces
branch
from
October 8, 2026 14:47
854fdbb to
7d4e4e0
Compare
Merging this PR will regress 1 benchmark
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | test_feature[prune-shared-single] |
89.1 µs | 96.7 µs | -7.83% |
| ⚡ | test_feature[shadow-slot-comments] |
137.9 µs | 110.1 µs | +25.23% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing gaborbernat:fix/markdown-code-span-spaces (7d4e4e0) with main (af31f20)
Footnotes
-
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. ↩
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.
to_markdownwrote inline code that starts and ends with a space as written.<p>x<code> a </code>y</p>becamex` a `y, and a reader strips one space from each end of such content (CommonMark 6.1), so it read back asxayin one word.Content that both starts and ends with a space, and is not all spaces, now gets one more space on each side, as content edged by a backtick already did. The example becomes
x` a `y.markdownify 1.2.3 writes
x `a` y, moving the spaces outside the code, and html2text 2025.4.15 writesx` a `y, which loses them.