Fixed url highlighting in editor

This commit is contained in:
benweet 2014-06-12 21:15:41 +01:00
parent a5719f45de
commit bef54c64b8

View File

@ -3,7 +3,7 @@ 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("(=\"|<)?\\b(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;
var latex = Prism.languages.latex; var latex = Prism.languages.latex;
@ -40,7 +40,13 @@ Prism.languages.md = (function () {
pattern: /^[ \t]*([*+\-]|\d+\.)[ \t].+(?:\n|[ \t].*\n)*/gm, pattern: /^[ \t]*([*+\-]|\d+\.)[ \t].+(?:\n|[ \t].*\n)*/gm,
inside: { inside: {
"md md-li": /^[ \t]*([*+\-]|\d+\.)[ \t]/m, "md md-li": /^[ \t]*([*+\-]|\d+\.)[ \t]/m,
'pre gfm': /^((?: {4}|\t)+)`{3}.*\n(?:[\s\S]*?)\n\1`{3} *$/gm, 'pre gfm': {
pattern: /^((?: {4}|\t)+)`{3}.*\n(?:[\s\S]*?)\n\1`{3} *$/gm,
inside: {
"md md-pre": /`{3}/,
lf: lf
}
},
lf: lf lf: lf
} }
}; };
@ -288,8 +294,6 @@ Prism.languages.md = (function () {
link: md.link, link: md.link,
imgref: md.imgref, imgref: md.imgref,
linkref: md.linkref, linkref: md.linkref,
url: md.url,
email: md.email,
strong: md.strong, strong: md.strong,
em: md.em, em: md.em,
strike: md.strike, strike: md.strike,