Commit 0a0afb0
fix(richtext-lexical): link markdown regex should not match similar looking image markdown (#15713)
The current regex matches the link markdown correctly:
```
[This is a link](https://example.com/foo/bar)
```
But it also matches the image markdown:
```

```
To fix this, a negative lookbehind is added which confirms that no `!`
is present before the match.
<!--
Thank you for the PR! Please go through the checklist below and make
sure you've completed all the steps.
Please review the
[CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md)
document in this repository if you haven't already.
The following items will ensure that your PR is handled as smoothly as
possible:
- PR Title must follow conventional commits format. For example, `feat:
my new feature`, `fix(plugin-seo): my fix`.
- Minimal description explained as if explained to someone not
immediately familiar with the code.
- Provide before/after screenshots or code diffs if applicable.
- Link any related issues/discussions from GitHub or Discord.
- Add review comments if necessary to explain to the reviewer the logic
behind a change
### What?
### Why?
### How?
Fixes #
-->
---------
Co-authored-by: German Jablonski <43938777+GermanJablo@users.noreply.github.com>1 parent 4861fa1 commit 0a0afb0
2 files changed
Lines changed: 13 additions & 2 deletions
File tree
- packages/richtext-lexical/src/features/link
- test/lexical-mdx
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
251 | 262 | | |
252 | 263 | | |
253 | 264 | | |
| |||
0 commit comments