From dbaac498786f21f342d881cb67e55fb7ee59b0ac Mon Sep 17 00:00:00 2001 From: Anis Ladram Date: Wed, 5 Dec 2018 18:03:12 -0500 Subject: [PATCH] Changed order of autolink processing --- lib/marked.js | 74 +++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/lib/marked.js b/lib/marked.js index c25fa07c..09aa559a 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -694,43 +694,6 @@ InlineLexer.prototype.output = function(src) { continue; } - // autolink - if (cap = this.rules.autolink.exec(src)) { - src = src.substring(cap[0].length); - if (cap[2] === '@') { - text = escape(this.mangle(cap[1])); - href = 'mailto:' + text; - } else { - text = escape(cap[1]); - href = text; - } - out += this.renderer.link(href, null, text); - continue; - } - - // url (gfm) - if (!this.inLink && (cap = this.rules.url.exec(src))) { - 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; - } else { - href = text; - } - } - src = src.substring(cap[0].length); - out += this.renderer.link(href, null, text); - continue; - } - // tag if (cap = this.rules.tag.exec(src)) { if (!this.inLink && /^