Skip to content

Commit bb490ff

Browse files
authoredSep 27, 2024··
fix: automatially register languages highlighted by Shiki to Monaco Editor (#1858)
1 parent 030021b commit bb490ff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎packages/client/setup/monaco.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const setup = createSingletonPromise(async () => {
9292
monaco.languages.register({ id: 'typescript' })
9393
monaco.languages.register({ id: 'javascript' })
9494

95-
const { shiki, themes, shikiToMonaco } = await import('#slidev/shiki')
95+
const { shiki, langs, themes, shikiToMonaco } = await import('#slidev/shiki')
9696
const highlighter = await shiki
9797

9898
const editorOptions: MonacoSetupReturn['editorOptions'] & object = {}
@@ -113,6 +113,10 @@ const setup = createSingletonPromise(async () => {
113113
: themes.light || 'vitesse-light')
114114
})
115115
}
116+
// Register all languages, otherwise Monaco will not highlight them
117+
for (const lang of langs) {
118+
monaco.languages.register({ id: lang })
119+
}
116120

117121
return {
118122
monaco,

0 commit comments

Comments
 (0)
Please sign in to comment.