Skip to content

fix(richtext-lexical): link markdown regex should not match similar looking image markdown#15713

Merged
GermanJablo merged 2 commits intopayloadcms:mainfrom
shobhitsinghal624:patch-2
Feb 26, 2026
Merged

fix(richtext-lexical): link markdown regex should not match similar looking image markdown#15713
GermanJablo merged 2 commits intopayloadcms:mainfrom
shobhitsinghal624:patch-2

Conversation

@shobhitsinghal624
Copy link
Copy Markdown
Contributor

The current regex matches the link markdown correctly:

[This is a link](https://example.com/foo/bar)

But it also matches the image markdown:

![This is an image](https://example.com/foo/image.jpg)

To fix this, a negative lookbehind is added which confirms that no ! is present before the match.

The current regex matches the link markdown correctly:

```
[This is a link](https://example.com/foo/bar)
```

But it also matches the image markdown:
```
![This is an image](https://example.com/foo/image.jpg)
```

To fix this, a negative lookbehind is added which confirms that no `!` is present before the match.
@AlessioGr AlessioGr requested review from GermanJablo and removed request for AlessioGr February 25, 2026 21:40
Copy link
Copy Markdown
Contributor

@GermanJablo GermanJablo left a comment

Choose a reason for hiding this comment

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

Thank you!

@GermanJablo GermanJablo merged commit 0a0afb0 into payloadcms:main Feb 26, 2026
150 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🚀 This is included in version v3.78.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants