Fixed URL and emails in editor

This commit is contained in:
benweet 2014-06-09 12:59:19 +01:00
parent 4d97ba5f84
commit 2305bb6207
2 changed files with 15 additions and 12 deletions

View File

@ -1,8 +1,10 @@
// Credit to https://editorially.com/
Prism.languages.md = (function () {
var urlPattern = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>\[\]'"]+|\([^\s()<>\[\]'"]*\))+(?:\([^\s()<>\[\]'"]*\)|[^\s`!()\[\]{}:'".,<>?«»“”‘’]))/gi;
var emailPattern = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b/gi;
var charInsideUrl = "[-A-Z0-9+&@#/%?=~_|[\\]()!:,.;]",
charEndingUrl = "[-A-Z0-9+&@#/%=~_|[\\])]";
var urlPattern = new RegExp("(=\"|<)?\\b(https?|ftp)(://" + charInsideUrl + "*" + charEndingUrl + ")(?=$|\\W)", "gi");
var emailPattern = /(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)/gi;
var latex = Prism.languages.latex;
@ -241,9 +243,6 @@ Prism.languages.md = (function () {
}
}
};
md.email = {
pattern: emailPattern
};
md.code = {
pattern: /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/g,
lookbehind: true,
@ -297,8 +296,11 @@ Prism.languages.md = (function () {
conflict: //g,
comment: Prism.languages.markup.comment,
tag: Prism.languages.markup.tag,
entity: Prism.languages.markup.entity
entity: Prism.languages.markup.entity,
url: urlPattern,
email: emailPattern
};
for (var c = 6; c >= 1; c--) {
md["h" + c].inside.rest = rest;
}

View File

@ -1223,11 +1223,6 @@ a {
.h6 { font-size: 0.9em; }
.url,
.email {
color: @tertiary-color-light;
}
.md, .hr {
color: @tertiary-color-light;
font-style: normal;
@ -1248,11 +1243,17 @@ a {
text-decoration: line-through
}
.url,
.email,
.md-underlined-text {
text-decoration: underline;
}
.img,
.linkdef .url {
color: @tertiary-color-light;
}
.img,
.imgref {
padding: 0.2em 0.4em;
padding-right: 0;