fix: custom code render

zio/stable
三咲智子 2022-11-25 15:11:33 +08:00
parent 8586d58b84
commit 6ca34cab85
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
1 changed files with 1 additions and 1 deletions

View File

@ -63,7 +63,7 @@ export function contentToVNode(
.replace(/<p>(```|~~~)([\s\S]+?)\1(\s|<br\s?\/?>)*<\/p>/g, (_1, _2, raw) => {
const plain = htmlToText(`<p>${raw}</p>`).trim()
const [lang, ...rest] = plain.split(/\n/)
return `<custom-code lang="${lang?.trim().toLowerCase() || ''}" code="${encodeURIComponent(rest.join('\n'))}" />`
return `<custom-code lang="${lang?.trim().toLowerCase() || ''}" code="${encodeURIComponent(rest.join('\n'))}"></custom-code>`
})
const tree = parseFragment(content)