Repository navigation
fix hard line break round-trip in commonmark renderer - #639
Merged
Merged
Conversation
Member
|
I'd prefer just to emit the backslash everywhere for hard breaks. |
zayeem06
force-pushed
the
hardbreak-roundtrip
branch
from
October 14, 2026 05:59
7122c72 to
7f2f7f8
Compare
Contributor
Author
|
Makes sense, that's simpler. Updated it to always emit the backslash break and dropped the positional check; tests still pass. |
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.
The commonmark renderer writes hard line breaks as two trailing spaces, but those are only recognized as a hard break when they follow other text on the line. When a hard break begins a line (a leading
\break, or one right after a soft break) or comes after a space, the spaces are stripped as insignificant trailing whitespace and the break, along with any preceding space, is lost when the output is parsed again. This emits a backslash line break in those positions and keeps the two-space form everywhere else; the new api_test cases cover the three positions and the roundtrip tests exercise it end to end.