fix(render): image url

This commit is contained in:
qingwei.li 2017-02-12 13:31:53 +08:00
parent fa54b52048
commit 6f87529256
2 changed files with 6 additions and 1 deletions

View File

@ -57,6 +57,12 @@ export function init () {
}
return `<p>${text}</p>`
}
renderer.image = function (href, title, text) {
const url = /:/.test(href) ? href : ($docsify.basePath + href).replace(/\/+/g, '/')
const titleHTML = title ? ` title="${title}"` : ''
return `<img src="${url}" alt="${text}"${titleHTML} />`
}
if (typeof $docsify.markdown === 'function') {
markdown.setOptions({ renderer })

View File

@ -164,4 +164,3 @@ export function emojify (text) {
.replace(/:(\w*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
.replace(/__colon__/g, ':')
}