Skip to content

Commit ae3f8dd

Browse files
SSDWGGmejo-
authored andcommitted
fix: allow dots in markdown link text
Signed-off-by: Jonas <jonas@freesources.org>
1 parent 1cb0e94 commit ae3f8dd

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

playwright/e2e/input-rules.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,16 @@ test('applies code mark input rule with preceding character (#5483)', async ({
1818
await expect(editor.el.locator('code')).toHaveText('code')
1919
await expect(editor.el.locator('p').first()).toHaveText('hello inline (code)')
2020
})
21+
22+
test('applies link mark input rule with dot in text (#7872)', async ({
23+
editor,
24+
open,
25+
}) => {
26+
await open()
27+
await editor.type('[example.org](https://example.org)')
28+
await expect(editor.el.locator('a').first()).toHaveText('example.org')
29+
await expect(editor.el.locator('a').first()).toHaveAttribute(
30+
'href',
31+
'https://example.org',
32+
)
33+
})

src/marks/Link.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ const Link = TipTapLink.extend<RelativePathLinkOptions>({
161161
},
162162

163163
addInputRules() {
164-
const linkInputRegex = /(?:^|\s)\[([\w|\s|-]+)\]\((?<href>.+?)\)$/gm
164+
const linkInputRegex = /(?:^|\s)\[([^[\]]+)\]\((?<href>.+?)\)$/gm
165165
return [
166166
markInputRule({
167167
find: linkInputRegex,

0 commit comments

Comments
 (0)