As far as I understood shiki's code, loadTheme is async only for the case when it needs to fetch the theme. Maybe there could be a different sync method for raw themes:
Even better (for me) would be to be able to pass themes that aren't loaded directly to codeToThemedTokens.
import rawTheme from "shiki/themes/poimandres.json"
function async someFunction(highlighter) {
// third param is a raw theme that isn't in the registry
const lines = highlighter.codeToThemedTokens("some code", "js", rawTheme)
}
Probably the same applies to the loadLanguage method and 'lang' parameter.
If I already have a
highlighter
and want to load a new raw theme (no fetching required) it would be great if I could do it withoutawait
ing.Currently, I need to do:
As far as I understood shiki's code,
loadTheme
is async only for the case when it needs to fetch the theme. Maybe there could be a different sync method for raw themes:Even better (for me) would be to be able to pass themes that aren't loaded directly to
codeToThemedTokens
.Probably the same applies to the
loadLanguage
method and 'lang' parameter.