-
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] Bug Fix: preserve the order of markdown tags for markdown combinations, and close the tags when the outmost tag is closed #5758
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hi @yhw5! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Hi @fantactuka I noticed that you have mainly been involved in the referenced issues and PRs above. Could you please take a look at this proposed change? If this could be merged, that would be really great! Thanks |
@@ -141,7 +141,11 @@ describe('Markdown', () => { | |||
}, | |||
{ | |||
html: '<p><span style="white-space: pre-wrap;">Hello </span><s><i><b><strong style="white-space: pre-wrap;">world</strong></b></i></s><span style="white-space: pre-wrap;">!</span></p>', | |||
md: 'Hello ~~***world***~~!', | |||
md: '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.
I changed the expected markdown here because I rearranged the order of tags in the markdownExport. The order change was to address edge cases, such as the one from L146-148, where the very first opening tag needs to be closed as the last one.
The unit tests and integrity should be OK now. Please help review, thanks |
@ivailop7 @fantactuka @acywatson @zurfyx @Fetz May I get review for this one? Appreciate your time 🙏 |
…mbinations and fix edge cases
QVQ any concerns regarding the fix? Really like to get the issue fixed especially for the current broken markdown combinations |
Does this also fix cases where multiple formats are being added/removed?
Example Text that is wrapped in bold |
yes exactly! |
size-limit report 📦
|
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 this looks good, not sure how it fell off the radar! Will approve and merge if the test suite is still in a good state.
Issue: #2303, #2632
Related PR: #2304
This PR aims to fix the following:
Closing tags were applied in a different order than opening tags.
Unclosed tags remain in the markdown for complex markdown combinations.
And this change should not add any unnecessary duplicate markdown tags
Examples:
Note: underline is a custom markdown here, the tag is "++". You can imagine it as strikethrough "~~"
bold, italic and underline combination + italic
markdown:
before:
++***BoldplusItalicplusUnderline**++Italic*
(unclosed italic inside the first block)after:
***++BoldplusItalicplusUnderline++****Italic*
(properly closed all the opening tags if the outmost one is closed)bold + underline and bold combination
markdown output:
before:
**bold++underline**++
(markdown tag order is wrong)after:
**bold++underline++**