mirror of
https://github.com/zhigang1992/docsify.git
synced 2026-04-01 12:43:06 +08:00
fix(render): image url
This commit is contained in:
@@ -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 })
|
||||
|
||||
@@ -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, ':')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user