Fixed url parsing regexp in Prism grammar. Fixed #634

This commit is contained in:
benweet 2014-12-14 20:06:02 +00:00
parent 8802ec82d4
commit 4c7cb8c0a4

View File

@ -1,7 +1,7 @@
Prism.languages.md = (function() { Prism.languages.md = (function() {
var charInsideUrl = "[-A-Z0-9+&@#/%?=~_|[\\]()!:,.;]", var charInsideUrl = "(&|[-A-Z0-9+@#/%?=~_|[\\]()!:,.;])",
charEndingUrl = "[-A-Z0-9+&@#/%=~_|[\\])]"; charEndingUrl = "(&|[-A-Z0-9+@#/%=~_|[\\])])";
var urlPattern = new RegExp("(https?|ftp)(://" + charInsideUrl + "*" + charEndingUrl + ")(?=$|\\W)", "gi"); var urlPattern = new RegExp("(https?|ftp)(://" + charInsideUrl + "*" + charEndingUrl + ")(?=$|\\W)", "gi");
var emailPattern = /(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)/gi; var emailPattern = /(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)/gi;