Skip to content

[lexical-markdown] Bug Fix: Prevent nesting links creation - #8164

Merged
etrepum merged 1 commit into
meta:mainfrom
levensta:markdown-nesting-links
Feb 23, 2026
Merged

etrepum merged 1 commit into
meta:mainfrom
levensta:markdown-nesting-links

Conversation

@levensta

Copy link
Copy Markdown
Contributor

Description

Fix for behavior where it is possible to create nested links by typing markdown link text inside LinkNode

https://spec.commonmark.org/0.31.2/#example-518

Test plan

Before

Screen.Recording.2026-02-23.at.16.54.29.mov

After

Screen.Recording.2026-02-23.at.16.56.55.mov

@vercel

vercel Bot commented Feb 23, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Feb 23, 2026 2:02pm
lexical-playground Ready Ready Preview, Comment Feb 23, 2026 2:02pm

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 Feb 23, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Feb 23, 2026
@etrepum

etrepum commented Feb 23, 2026 •

Copy link
Copy Markdown
Collaborator

An alternative approach would be that the shortcut still works in these scenarios but it would split the parent link accordingly. Might make sense in the case where AutoLinkNode is involved especially when it's marked as disabled. The transform should probably handle that edge case better (removing disabled AutoLinkNode when they are sufficiently changed to no longer parse as a link).

@etrepum
etrepum added this pull request to the merge queue Feb 23, 2026
Merged via the queue into meta:main with commit 7517801 Feb 23, 2026
41 checks passed
@levensta

Copy link
Copy Markdown
Contributor Author

Might make sense in the case where AutoLinkNode is involved especially when it's marked as disabled. There transform should probably handle that edge case better (removing disabled AutoLinkNode when they are sufficiently changed to no longer parse as a link).

I think the case with AutoLinkNode disabled would be better handled in AutoLinkExtension, because now, with unlinked autolink, you can write any text inside, unlike when the node is linked. Currently, it seems that valid text checking is disabled if the node is unlinked. I think it's right to check the valid text for AutoLinkNode regardless of the linked/unlinked state

Screen.Recording.2026-02-23.at.23.49.44.mov

@etrepum

etrepum commented Feb 23, 2026

Copy link
Copy Markdown
Collaborator

Yes, the transform in the AutoLink extension is what I was referring to in that comment. Not strictly relevant to this transform which is why I thought it made sense to approve and merge as-is

levensta added a commit to levensta/lexical that referenced this pull request Feb 23, 2026
@etrepum etrepum mentioned this pull request Feb 25, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical-playground — e899f57a Deployed Feb 23, 2026 by vercel[bot]
Preview – lexical — e899f57a Deployed Feb 23, 2026 by vercel[bot]
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