fix(compiler): link
This commit is contained in:
parent
c108645e34
commit
c7e09c34a7
1 changed files with 7 additions and 1 deletions
|
|
@ -67,7 +67,13 @@ renderer.code = function (code, lang = '') {
|
||||||
return `<pre v-pre data-lang="${lang}"><code class="lang-${lang}">${hl}</code></pre>`
|
return `<pre v-pre data-lang="${lang}"><code class="lang-${lang}">${hl}</code></pre>`
|
||||||
}
|
}
|
||||||
renderer.link = function (href, title, text) {
|
renderer.link = function (href, title, text) {
|
||||||
return `<a href="${toURL(href)}" title="${title || text}">${text}</a>`
|
let blank = ''
|
||||||
|
if (!/:|(\/{2})/.test(href)) {
|
||||||
|
href = toURL(href)
|
||||||
|
} else {
|
||||||
|
blank = ' target="_blank"'
|
||||||
|
}
|
||||||
|
return `<a href="${href}" title="${title || text}"${blank}>${text}</a>`
|
||||||
}
|
}
|
||||||
renderer.paragraph = function (text) {
|
renderer.paragraph = function (text) {
|
||||||
if (/^!>/.test(text)) {
|
if (/^!>/.test(text)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue