mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-23 16:30:45 +01:00
docs: move shiki highlighter to composable (#1325)
This commit is contained in:
27
docs/composables/useShikiHighlighter.ts
Normal file
27
docs/composables/useShikiHighlighter.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { createShikiHighlighter } from '@nuxtjs/mdc/runtime/highlighter/shiki'
|
||||
import MaterialTheme from 'shiki/themes/material-theme.mjs'
|
||||
import MaterialThemeLighter from 'shiki/themes/material-theme-lighter.mjs'
|
||||
import MaterialThemePalenight from 'shiki/themes/material-theme-palenight.mjs'
|
||||
import HtmlLang from 'shiki/langs/html.mjs'
|
||||
import MdcLang from 'shiki/langs/mdc.mjs'
|
||||
import VueLang from 'shiki/langs/vue.mjs'
|
||||
|
||||
let highlighter
|
||||
export const useShikiHighlighter = () => {
|
||||
if (!highlighter) {
|
||||
highlighter = createShikiHighlighter({
|
||||
bundledThemes: {
|
||||
'material-theme': MaterialTheme,
|
||||
'material-theme-lighter': MaterialThemeLighter,
|
||||
'material-theme-palenight': MaterialThemePalenight
|
||||
},
|
||||
bundledLangs: {
|
||||
html: HtmlLang,
|
||||
mdc: MdcLang,
|
||||
vue: VueLang
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return highlighter
|
||||
}
|
||||
Reference in New Issue
Block a user