fix(render): image url
This commit is contained in:
parent
fa54b52048
commit
6f87529256
2 changed files with 6 additions and 1 deletions
|
|
@ -57,6 +57,12 @@ export function init () {
|
||||||
}
|
}
|
||||||
return `<p>${text}</p>`
|
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') {
|
if (typeof $docsify.markdown === 'function') {
|
||||||
markdown.setOptions({ renderer })
|
markdown.setOptions({ renderer })
|
||||||
|
|
|
||||||
|
|
@ -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(/:(\w*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
|
||||||
.replace(/__colon__/g, ':')
|
.replace(/__colon__/g, ':')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue