-
Notifications
You must be signed in to change notification settings - Fork 151
/
highlight.ts
22 lines (20 loc) · 688 Bytes
/
highlight.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import * as monaco from 'monaco-editor-core'
import { getHighlighterCore } from 'shikiji/core'
import { getWasmInlined } from 'shikiji/wasm'
import { shikijiToMonaco } from 'shikiji-monaco'
import langVue from 'shikiji/langs/vue.mjs'
import themeDark from 'shikiji/themes/dark-plus.mjs'
import themeLight from 'shikiji/themes/light-plus.mjs'
export async function registerHighlighter() {
const highlighter = await getHighlighterCore({
themes: [themeDark, themeLight],
langs: [langVue],
loadWasm: getWasmInlined,
})
monaco.languages.register({ id: 'vue' })
shikijiToMonaco(highlighter, monaco)
return {
light: themeLight.name!,
dark: themeDark.name!,
}
}