Skip to content

Commit 1c41c41

Browse files
committed
[gfm mode] Simplify URL regexp, since it's crashing Chrome
Issue #1160
1 parent 2dafec9 commit 1c41c41

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mode/gfm/gfm.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ CodeMirror.defineMode("gfm", function(config) {
7575
return "link";
7676
}
7777
}
78-
if (stream.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»]))/i)) {
78+
if (stream.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`!()\[\]{};:'".,<>?«»]))/i)) {
7979
// URLs
8080
// Taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls
81+
// And then (issue #1160) simplified to make it not crash the Chrome Regexp engine
8182
return "link";
8283
}
8384
stream.next();

0 commit comments

Comments
 (0)