[lexical-markdown] Bug Fix: Preserve markdown hard line breaks during import when newlines are preserved#8265
Merged
etrepum merged 5 commits intofacebook:mainfrom Apr 1, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
|
This PR doesn't look like it solves the issue that it claims to close, this one only changes the behavior of trailing backslash and not leading/trailing whitespace |
Contributor
Author
You're right, I missed the part of the request about leading whitespace. I was just focused on trailing whitespace (for indicating hard line-breaks with trailing double spaces). I can modify this to also account for leading white space. |
etrepum
approved these changes
Apr 1, 2026
Collaborator
etrepum
left a comment
There was a problem hiding this comment.
This seems reasonable at least as far as the existing test suite goes
Merged
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.
Description
I noticed that hard line breaks in markdown could get lost after an import and edit flow, when the markdown is toggled into the editor and then saved back out.
(this is my first contribution to this project, so please let me know if I should be doing anything differently)
This PR keeps hard-break intent intact when newline preservation is enabled:
Handles two trailing spaces before a newline as a hard break marker during import line merge handling.
-- foo followed by two spaces and a newline
-- foo followed by backslash and a newline
I also added coverage around normalization behavior so the merge path is tested directly.
Closes #4843
Test plan
Before
###After
-- markdown hard line break import: preserves hard line break when shouldPreserveNewLines is true
-- markdown hard line break import: preserves backslash hard line break when shouldPreserveNewLines is true