From 36ea7f6b4e91f3eb4cc9157b7b9b4573c2656ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Fri, 25 Nov 2022 15:25:44 +0800 Subject: [PATCH] fix: render code block --- composables/content.ts | 2 +- composables/shiki.ts | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) 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 `` diff --git a/composables/shiki.ts b/composables/shiki.ts index dfd097a6..1b43ab32 100644 --- a/composables/shiki.ts +++ b/composables/shiki.ts @@ -15,9 +15,6 @@ export function highlightCode(code: string, lang: Lang) { 'vitesse-dark', 'vitesse-light', ], - langs: [ - lang, - ], }) }) }