-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lexical-markdown] Fix: normalize markdown in $convertFromMarkdownString to comply with CommonMark spec (2nd try) #6629
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
Co-authored-by: Bob Ippolito <bob@redivi.com>
I can repro. Haven't looked at the code but there's a very bad performance issue in all browsers in that test case (hangs for >10 seconds on my laptop in chrome after the second click to the markdown button), but probably just bad enough that the firefox test fails.
Screen.Recording.2024-09-12.at.17.58.25.mov |
Screen.Recording.2024-09-13.at.12.06.25.PM.movlgtm for multi line seperation case, but for single line + shouldPreserveNewLinesInMarkdown=true, it breaks before Screen.Recording.2024-09-13.at.12.15.50.PM.movafter Screen.Recording.2024-09-13.at.12.14.16.PM.mov |
@@ -82,11 +83,12 @@ function $convertFromMarkdownString( | |||
node?: ElementNode, | |||
shouldPreserveNewLines = false, | |||
): void { | |||
const sanitizedMarkdown = normalizeMarkdown(markdown); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a condition here, to only normalizeMarkdown if shouldPreserveNewLines = false?
internally we are using the shouldPreserveNewLines = true feature and normalizeMarkdown is causing eg.
hello
hello
to convert to
hellohello
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add some test coverage for this to prevent such regressions in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in d58c159
Co-authored-by: Sherry <sherrywong105@gmail.com>
Description
See #6627
The only commits added since the first PR are:
For both cases I added corresponding tests.