diff --git a/lib/renderer.js b/lib/renderer.js index 45715ea..59c1bfa 100644 --- a/lib/renderer.js +++ b/lib/renderer.js @@ -3,7 +3,6 @@ const marked = require('marked'); const { encodeURL, slugize, stripHTML, url_for, isExternalLink } = require('hexo-util'); const MarkedRenderer = marked.Renderer; -const { parse } = require('url'); const { sep } = require('path'); let hexo; @@ -93,16 +92,15 @@ class Renderer extends MarkedRenderer { const { relative_link } = hexo.config; const { options } = this; const { lazyload, prependRoot, postId } = options; - const { hostname } = parse(href); - if (!hostname && !relative_link && prependRoot) { + if (!relative_link && prependRoot) { if (postId) { const PostAsset = hexo.model('PostAsset'); // slug requires platform-specific path const asset = PostAsset.findOne({ post: postId, slug: href.replace(/\/|\\/g, sep) }); if (asset) href = encodeURL(('/' + asset.path).replace(/\\/g, '/').replace(/\/{2,}/g, '/')); } - href = url_for.call(options, href); + href = url_for.call(hexo, href); } let out = `