diff --git a/lib/resolve.js b/lib/resolve.js index 83a4328..d384048 100644 --- a/lib/resolve.js +++ b/lib/resolve.js @@ -47,9 +47,9 @@ resolve.resolveLinks = function (string, sanitize = escape) { } } - const external = (match, href, protocol, rest) => + const external = (match, href, rest) => stash( - `${escape(rest)} `, + `${escape(rest)} `, ) // markup conversion happens in four phases: @@ -61,6 +61,6 @@ resolve.resolveLinks = function (string, sanitize = escape) { string = (string || '') .replace(/〖(\d+)〗/g, '〖 $1 〗') .replace(/\[\[([^\]]+)\]\]/gi, internal) - .replace(/\[((http|https|ftp):.*?) (.*?)\]/gi, external) + .replace(/\[((?:(?:https?|ftp):|\/).*?) (.*?)\]/gi, external) return sanitize(string).replace(/〖(\d+)〗/g, unstash) }