Fixed url highlighting in editor
This commit is contained in:
parent
a5719f45de
commit
bef54c64b8
@ -1,9 +1,9 @@
|
|||||||
// Credit to https://editorially.com/
|
// Credit to https://editorially.com/
|
||||||
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("(=\"|<)?\\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;
|
||||||
@ -28,7 +28,7 @@ Prism.languages.md = (function () {
|
|||||||
inside: {
|
inside: {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for (var i = 6; i >= 1; i--) {
|
for(var i = 6; i >= 1; i--) {
|
||||||
md["h" + i] = {
|
md["h" + i] = {
|
||||||
pattern: new RegExp("^#{" + i + "}.+$", "gm"),
|
pattern: new RegExp("^#{" + i + "}.+$", "gm"),
|
||||||
inside: {
|
inside: {
|
||||||
@ -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,
|
||||||
@ -301,7 +305,7 @@ Prism.languages.md = (function () {
|
|||||||
email: emailPattern
|
email: emailPattern
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var c = 6; c >= 1; c--) {
|
for(var c = 6; c >= 1; c--) {
|
||||||
md["h" + c].inside.rest = rest;
|
md["h" + c].inside.rest = rest;
|
||||||
}
|
}
|
||||||
md["h1 alt"].inside.rest = rest;
|
md["h1 alt"].inside.rest = rest;
|
||||||
|
Loading…
Reference in New Issue
Block a user