mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 16:38:20 +01:00
refactor: 🔥 Remove syntax highlighting for performance
This commit is contained in:
parent
68e5ede6c6
commit
55ca97e936
|
|
@ -66,17 +66,16 @@ export const useParsedContent = (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Highlight code blocks
|
// Highlight code blocks
|
||||||
const codeBlocks = contentHtml.querySelectorAll("pre code");
|
/* const codeBlocks = contentHtml.querySelectorAll("pre code");
|
||||||
for (const codeBlock of codeBlocks) {
|
for (const codeBlock of codeBlocks) {
|
||||||
const code = codeBlock.textContent;
|
const code = codeBlock.textContent;
|
||||||
if (!code) {
|
if (!code) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const newCode = (await getShikiHighlighter()).highlight(code, {
|
|
||||||
lang: codeBlock
|
const highligher = await getShikiHighlighter();
|
||||||
.getAttribute("class")
|
|
||||||
?.replace("language-", ""),
|
const newCode = highligher.highlight(code, {});
|
||||||
});
|
|
||||||
|
|
||||||
// Replace parent pre tag with highlighted code
|
// Replace parent pre tag with highlighted code
|
||||||
const parent = codeBlock.parentElement;
|
const parent = codeBlock.parentElement;
|
||||||
|
|
@ -84,7 +83,7 @@ export const useParsedContent = (
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
parent.outerHTML = newCode;
|
parent.outerHTML = newCode;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
result.value = contentHtml.innerHTML;
|
result.value = contentHtml.innerHTML;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ export default defineNuxtConfig({
|
||||||
"@nuxt/fonts",
|
"@nuxt/fonts",
|
||||||
"nuxt-icon",
|
"nuxt-icon",
|
||||||
"@vee-validate/nuxt",
|
"@vee-validate/nuxt",
|
||||||
"nuxt-shiki",
|
//"nuxt-shiki",
|
||||||
],
|
],
|
||||||
|
|
||||||
app: {
|
app: {
|
||||||
|
|
@ -24,7 +24,7 @@ export default defineNuxtConfig({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
shiki: {
|
/* shiki: {
|
||||||
defaultTheme: "rose-pine",
|
defaultTheme: "rose-pine",
|
||||||
bundledLangs: [
|
bundledLangs: [
|
||||||
"javascript",
|
"javascript",
|
||||||
|
|
@ -41,7 +41,7 @@ export default defineNuxtConfig({
|
||||||
"shell",
|
"shell",
|
||||||
"yaml",
|
"yaml",
|
||||||
],
|
],
|
||||||
},
|
}, */
|
||||||
|
|
||||||
nitro: {
|
nitro: {
|
||||||
preset: "bun",
|
preset: "bun",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue