fix: custom code render
This commit is contained in:
parent
8586d58b84
commit
6ca34cab85
|
@ -63,7 +63,7 @@ export function contentToVNode(
|
||||||
.replace(/<p>(```|~~~)([\s\S]+?)\1(\s|<br\s?\/?>)*<\/p>/g, (_1, _2, raw) => {
|
.replace(/<p>(```|~~~)([\s\S]+?)\1(\s|<br\s?\/?>)*<\/p>/g, (_1, _2, raw) => {
|
||||||
const plain = htmlToText(`<p>${raw}</p>`).trim()
|
const plain = htmlToText(`<p>${raw}</p>`).trim()
|
||||||
const [lang, ...rest] = plain.split(/\n/)
|
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)
|
const tree = parseFragment(content)
|
||||||
|
|
Loading…
Reference in a new issue