-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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] shouldMergeAdjacentLines as an option #6642
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
html: '<p><span style="white-space: pre-wrap;">helloworld</span></p>', | ||
md: 'hello\nworld', | ||
shouldNormalizeMarkdown: true, | ||
skipExport: true, |
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.
skipping export because:
string -> md -> string
(string)
hello
world
to (md)helloworld
to (string)helloworld
does not convert back to
(string)
hello
world
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.
shouldPreserveNewLines
is a specific flag while shouldNormalizeMarkdown
is very high-level, I don't think they play well with each other and the code shows how we have to chain conditions to make it work.
I would consider targetting the specific parts of the MarkDown we don't want to normalize as opposed to the normalize
function as a whole which is an internal implementation.
good point, i updated to shouldMergeAdjacentLines instead and placed its in a specific place in normalise markdown |
Description
normalize markdown was introduced in #6629 . one of the significant behavior change this introduced is merging adjacent non empty lines, according to commonmark spec: https://spec.commonmark.org/0.24/#example-177
it is a welcomed change since that brings lexical's impl closer to commonmark. However to avoid breaking current callsites, im making the normalizedMarkdown an option default to true, so it is easier to rollback incase this new behavior causes a regression somewhere downstream
ultimately, if there is no known usecase to have shouldMergeAdjacentLines = false, will look to deprecate shouldMergeAdjacentLines and have it always be true.
Test plan
shouldMergeAdjacentLines = true
Screen.Recording.2024-09-18.at.6.09.06.PM.mov
shouldMergeAdjacentLines = false
Screen.Recording.2024-09-18.at.6.11.26.PM.mov
added automated tests