Skip to content

Commit eb28b62

Browse files
Autolinker: Improved URL regex (#1842)
This changes the regex for matching URLs to include the `@` character and improves the pattern to avoid backtracking.
1 parent c13d6e7 commit eb28b62

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

plugins/autolinker/prism-autolinker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (
77
return;
88
}
99

10-
var url = /\b([a-z]{3,7}:\/\/|tel:)[\w\-+%~/.:=&]+(?:\?[\w\-+%~/.:#=?&!$'()*,;]*)?(?:#[\w\-+%~/.:#=?&!$'()*,;]*)?/,
10+
var url = /\b([a-z]{3,7}:\/\/|tel:)[\w\-+%~/.:=&@]+(?:\?[\w\-+%~/.:=?&!$'()*,;@]*)?(?:#[\w\-+%~/.:#=?&!$'()*,;@]*)?/,
1111
email = /\b\S+@[\w.]+[a-z]{2}/,
1212
linkMd = /\[([^\]]+)]\(([^)]+)\)/,
1313

plugins/autolinker/prism-autolinker.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)