From 55ca97e936c0d6039b16e754cacb105f90b507e8 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Mon, 29 Apr 2024 11:05:58 -1000 Subject: [PATCH] refactor: :fire: Remove syntax highlighting for performance --- composables/ParsedContent.ts | 13 ++++++------- nuxt.config.ts | 6 +++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/composables/ParsedContent.ts b/composables/ParsedContent.ts index 995e94d..d8e0621 100644 --- a/composables/ParsedContent.ts +++ b/composables/ParsedContent.ts @@ -66,17 +66,16 @@ export const useParsedContent = ( } // Highlight code blocks - const codeBlocks = contentHtml.querySelectorAll("pre code"); + /* const codeBlocks = contentHtml.querySelectorAll("pre code"); for (const codeBlock of codeBlocks) { const code = codeBlock.textContent; if (!code) { continue; } - const newCode = (await getShikiHighlighter()).highlight(code, { - lang: codeBlock - .getAttribute("class") - ?.replace("language-", ""), - }); + + const highligher = await getShikiHighlighter(); + + const newCode = highligher.highlight(code, {}); // Replace parent pre tag with highlighted code const parent = codeBlock.parentElement; @@ -84,7 +83,7 @@ export const useParsedContent = ( continue; } parent.outerHTML = newCode; - } + }*/ result.value = contentHtml.innerHTML; }, diff --git a/nuxt.config.ts b/nuxt.config.ts index d8e3643..b9b0eca 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -8,7 +8,7 @@ export default defineNuxtConfig({ "@nuxt/fonts", "nuxt-icon", "@vee-validate/nuxt", - "nuxt-shiki", + //"nuxt-shiki", ], app: { @@ -24,7 +24,7 @@ export default defineNuxtConfig({ }, }, - shiki: { + /* shiki: { defaultTheme: "rose-pine", bundledLangs: [ "javascript", @@ -41,7 +41,7 @@ export default defineNuxtConfig({ "shell", "yaml", ], - }, + }, */ nitro: { preset: "bun",