mirror of
https://github.com/jaandrle/deka-dom-el
synced 2024-11-25 17:49:37 +01:00
13 lines
429 B
JavaScript
13 lines
429 B
JavaScript
const highlighter= await globalThis.shiki.getHighlighter({
|
|
theme: "css-variables",
|
|
langs: ["js", "ts", "css", "html", "shell"],
|
|
});
|
|
const codeBlocks= document.querySelectorAll('code[class*="language-"]');
|
|
|
|
codeBlocks.forEach((block)=> {
|
|
const lang= block.className.replace("language-", "");
|
|
block.parentElement.dataset.js= "done";
|
|
const html= highlighter.codeToHtml(block.textContent, { lang });
|
|
block.innerHTML= html;
|
|
});
|