|
|
@ -8,6 +8,8 @@ |
|
|
|
var Autolinker = require('autolinker'); |
|
|
|
|
|
|
|
|
|
|
|
var LINK_SCAN_RE = /www|\:\/\//; |
|
|
|
|
|
|
|
var links = []; |
|
|
|
var autolinker = new Autolinker({ |
|
|
|
stripPrefix: false, |
|
|
@ -41,10 +43,9 @@ module.exports = function linkify(t, state) { |
|
|
|
// Skip content of markdown links
|
|
|
|
if (token.type === 'link_close') { |
|
|
|
i--; |
|
|
|
while (tokens[i].type !== 'link_open' && tokens[i].level !== token.level) { |
|
|
|
while (tokens[i].level !== token.level && tokens[i].type !== 'link_open') { |
|
|
|
i--; |
|
|
|
} |
|
|
|
i--; |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
@ -59,9 +60,8 @@ module.exports = function linkify(t, state) { |
|
|
|
} |
|
|
|
if (htmlLinkLevel > 0) { continue; } |
|
|
|
|
|
|
|
if (token.type === 'text' && |
|
|
|
(token.content.indexOf('://') || |
|
|
|
token.content.indexOf('www'))) { |
|
|
|
if (token.type === 'text' && LINK_SCAN_RE.test(token.content)) { |
|
|
|
|
|
|
|
text = token.content; |
|
|
|
links = []; |
|
|
|
autolinker.link(text); |
|
|
|