UNPKG

@oiij/naive-ui

Version:

Some Composable Functions And Components for Vue 3

16 lines (14 loc) 457 B
import Prism from "prismjs"; //#region src/components/_utils/prismjs.ts if (typeof document !== "undefined") Prism.highlightAll(); function highlight(code, lang) { try { const grammar = Prism.languages[lang]; if (grammar) return `<pre class="language-${lang}"><code class="language-${lang}">${Prism.highlight(code, grammar || Prism.languages.text, lang)}</code></pre>`; return code; } catch { return code; } } //#endregion export { highlight };