Skip to content

[lexical-markdown] Bug Fix: update backslash escape handling to align with CommonMark#8192

Merged
etrepum merged 11 commits intofacebook:mainfrom
kimseongyu:fix-backslash-injection-making-incorrect-md-transform
Mar 5, 2026
Merged

[lexical-markdown] Bug Fix: update backslash escape handling to align with CommonMark#8192
etrepum merged 11 commits intofacebook:mainfrom
kimseongyu:fix-backslash-injection-making-incorrect-md-transform

Conversation

@kimseongyu
Copy link
Copy Markdown
Contributor

Description

This PR aligns with the CommonMark Spec regarding backslash escapes.

  1. Improved the text parsing regex to handle backslash escapes more accurately.
  2. Added the logic that converted backslashes to hard line breaks.
  3. Updated incorrect link test cases and refactored related logic.

The following cases can not supported before update of the related functions:

`` \[\` ``
<https://example.com?find=\*>

Related Issue #7824

Close the related issue after addressed the single line recursive list.

Test plan

Before

before.mov

After

after.mov

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Mar 5, 2026 6:17pm
lexical-playground Ready Ready Preview, Comment Mar 5, 2026 6:17pm

Request Review

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 4, 2026
Copy link
Copy Markdown
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good at first pass but I will have to spend some more time comparing the behavior to commonmark before final approval

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Mar 4, 2026
Copy link
Copy Markdown
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the behavior matches up with CommonMark, but let's make that small cleanup so the code isn't repeated

@etrepum
Copy link
Copy Markdown
Collaborator

etrepum commented Mar 5, 2026

GitHub actions are currently broken so I will have to check back in later

@kimseongyu
Copy link
Copy Markdown
Contributor Author

I've updated the code style to comply with Prettier.

@etrepum etrepum added this pull request to the merge queue Mar 5, 2026
Merged via the queue into facebook:main with commit 5171b4a Mar 5, 2026
34 checks passed
@kimseongyu kimseongyu deleted the fix-backslash-injection-making-incorrect-md-transform branch March 5, 2026 19:48
@etrepum etrepum mentioned this pull request Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants