Skip to content

How to load a custom theme for Shiki highlighting? #4702

Answered by brc-dd
pelevesque asked this question in Q&A
Discussion options

You must be logged in to vote

What kind of theme file do you have? It needs textmate theme in json. If by "type error" you meant errors shown by TypeScript, you can safely ts-ignore it or cast it as any. Inferring deep types from JSON doesn't work properly.

You don't need to call loadTheme though. You don't need to call loadLanguage either, you can just pass languages: [grammar1, grammar2].

https://stackblitz.com/edit/vite-cz6amcgi?file=docs/.vitepress/config.ts

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by pelevesque
Comment options

You must be logged in to vote
4 replies
@brc-dd
Comment options

@pelevesque
Comment options

@brc-dd
Comment options

@pelevesque
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants