Skip to content

Commit

Permalink
fix(render): render link
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed Feb 12, 2017
1 parent 9e81a59 commit 38ea660
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function init () {
return `<pre v-pre data-lang="${lang}"><code class="lang-${lang}">${hl}</code></pre>`
}
renderer.link = function (href, title, text) {
if (!/:/.test(href)) {
if (!/[:|\/+]/.test(href)) {
href = `#/${href}`.replace(/\/+/g, '/')
}

Expand All @@ -58,7 +58,7 @@ export function init () {
return `<p>${text}</p>`
}
renderer.image = function (href, title, text) {
const url = /:/.test(href) ? href : ($docsify.basePath + href).replace(/\/+/g, '/')
const url = /[:|\/+]/.test(href) ? href : ($docsify.basePath + href).replace(/\/+/g, '/')
const titleHTML = title ? ` title="${title}"` : ''

return `<img src="${url}" alt="${text}"${titleHTML} />`
Expand Down

0 comments on commit 38ea660

Please sign in to comment.