[gfm] only do backtracking (extended autolink path validation) for www or http autolinks
This commit is contained in:
parent
33408b9494
commit
8117b56a2e
@ -705,15 +705,15 @@ InlineLexer.prototype.output = function(src) {
|
||||
|
||||
// url (gfm)
|
||||
if (!this.inLink && (cap = this.rules.url.exec(src))) {
|
||||
do {
|
||||
prevCapZero = cap[0];
|
||||
cap[0] = this.rules._backpedal.exec(cap[0])[0];
|
||||
} while (prevCapZero !== cap[0]);
|
||||
src = src.substring(cap[0].length);
|
||||
if (cap[2] === '@') {
|
||||
text = escape(cap[0]);
|
||||
href = 'mailto:' + text;
|
||||
} else {
|
||||
// do extended autolink path validation
|
||||
do {
|
||||
prevCapZero = cap[0];
|
||||
cap[0] = this.rules._backpedal.exec(cap[0])[0];
|
||||
} while (prevCapZero !== cap[0]);
|
||||
text = escape(cap[0]);
|
||||
if (cap[1] === 'www.') {
|
||||
href = 'http://' + text;
|
||||
@ -721,6 +721,7 @@ InlineLexer.prototype.output = function(src) {
|
||||
href = text;
|
||||
}
|
||||
}
|
||||
src = src.substring(cap[0].length);
|
||||
out += this.renderer.link(href, null, text);
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user