Repository navigation
Keep block image URLs on one line when wrapping - #18
Open
nickweisser wants to merge 1 commit into
Open
nickweisser wants to merge 1 commit into
nickweisser wants to merge 1 commit into
Conversation
Links are protected from line_wrap() by the U+E0001/U+E007F markers, block images were not, so long image URLs got split across lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BmWt9BEUBt7RHPQWWDwZYt
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.
When
line_wrap()wraps a paragraph, links are protected by the U+E0001 / U+E007F markers thatLine_Bufferputs around them. Block images don't get these markers, so a long image URL is split across lines:A CommonMark link destination can't contain a line ending, so this no longer parses as an image. You can see it on wordpress.org right now: all 51 images in https://wordpress.org/news/2026/11/wc-asia-2027-penang/?output_format=md are split like this. Same for https://wordpress.org/news/2026/11/reprint-your-site/?output_format=md.
This PR wraps the block image output in the same markers as links, so
line_wrap()treats the whole image as unbreakable. Wrapping of normal text is unchanged.Testing:
tests/spec-documents/line-wrapping-1.html. It fails on trunk and passes with this change. All 64 tests pass.soft_line_wrapof 80). Before: 16 broken image URLs. After: 0. Only the image lines change in the output.AI assistance: I used Claude Code (Claude Opus 5.5) to find the cause, write the change and the test, and compare the output. I reviewed the diff and the test results myself.