diff --git a/composables/content.ts b/composables/content.ts index 05909c3c..892fe787 100644 --- a/composables/content.ts +++ b/composables/content.ts @@ -60,7 +60,7 @@ export function contentToVNode( return `:${name}:` }) // handle code frames - .replace(/
(```|~~~)([\s\S]+?)\1(\s|
)*<\/p>/g, (_1, _2, raw) => {
+ .replace(/
(```|~~~)([\s\S]+?)\1/g, (_1, _2, raw) => { const plain = htmlToText(`
${raw}
`).trim() const [lang, ...rest] = plain.split(/\n/) return `