Skip to content

Commit

Permalink
Autolinker: Improved URL regex (#1842)
Browse files Browse the repository at this point in the history
This changes the regex for matching URLs to include the `@` character and improves the pattern to avoid backtracking.
  • Loading branch information
RunDevelopment committed Apr 19, 2019
1 parent c13d6e7 commit eb28b62
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugins/autolinker/prism-autolinker.js
Expand Up @@ -7,7 +7,7 @@ if (
return;
}

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

Expand Down
2 changes: 1 addition & 1 deletion plugins/autolinker/prism-autolinker.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eb28b62

Please sign in to comment.