Skip to content

[lexical-markdown] Bug Fix: Ensure First Match is Used in importTextMatchTransformer#7890

Merged
etrepum merged 2 commits intofacebook:mainfrom
jkjk822:patch-2
Sep 30, 2025
Merged

[lexical-markdown] Bug Fix: Ensure First Match is Used in importTextMatchTransformer#7890
etrepum merged 2 commits intofacebook:mainfrom
jkjk822:patch-2

Conversation

@jkjk822
Copy link
Copy Markdown
Contributor

@jkjk822 jkjk822 commented Sep 30, 2025

Description

Ensure we use the first match if there are multiple on a line (when "outermost" is ambiguous), rather than just the match from the first transformer that ran on the line.

This prevents cases where there is a TextFormatTransformer match in an earlier TextMatchTransformer. The TextFormatTransformer will segment the earlier TextMatchTransformer so that it is never parsed correct. See added test for an example that failed before this fix (the link would not be parsed and the raw link markdown was present in the final output).

Test plan

Before

Added test failed

After

Added test passes

Ensure we use the first match if there are multiple on a line (when "outermost" is ambiguous), rather than just the match from the first transformer that ran on the line.

This prevents cases where there is a `TextFormatTransformer` match in an earlier `TextMatchTransformer`. The `TextFormatTransformer` will segment the earlier `TextMatchTransformer` so that it is never parsed correct. See added test for an example that failed before this fix (the link would not be parsed and the raw link markdown was present in the final output).
@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 Sep 30, 2025
@vercel
Copy link
Copy Markdown

vercel bot commented Sep 30, 2025

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

Project Deployment Preview Comments Updated (UTC)
lexical Ready Ready Preview Comment Sep 30, 2025 1:39pm
lexical-playground Ready Ready Preview Comment Sep 30, 2025 1:39pm

@etrepum etrepum enabled auto-merge September 30, 2025 15:21
@etrepum etrepum added this pull request to the merge queue Sep 30, 2025
Merged via the queue into facebook:main with commit 834cc7e Sep 30, 2025
39 checks passed
@etrepum etrepum mentioned this pull request Oct 1, 2025
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants