Skip to content

Commit 6f87529

Browse files
committed
fix(render): image url
1 parent fa54b52 commit 6f87529

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/render.js

+6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ export function init () {
5757
}
5858
return `<p>${text}</p>`
5959
}
60+
renderer.image = function (href, title, text) {
61+
const url = /:/.test(href) ? href : ($docsify.basePath + href).replace(/\/+/g, '/')
62+
const titleHTML = title ? ` title="${title}"` : ''
63+
64+
return `<img src="${url}" alt="${text}"${titleHTML} />`
65+
}
6066

6167
if (typeof $docsify.markdown === 'function') {
6268
markdown.setOptions({ renderer })

src/util.js

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

0 commit comments

Comments
 (0)