Skip to content

Commit

Permalink
fix(render): image url
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed Feb 12, 2017
1 parent fa54b52 commit 6f87529
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/render.js
Expand Up @@ -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 })
Expand Down
1 change: 0 additions & 1 deletion src/util.js
Expand Up @@ -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, ':')
}

0 comments on commit 6f87529

Please sign in to comment.