diff --git a/packages/core/src/constructors/internal-sync.ts b/packages/core/src/constructors/internal-sync.ts index f0b0e5e28..71506c52d 100644 --- a/packages/core/src/constructors/internal-sync.ts +++ b/packages/core/src/constructors/internal-sync.ts @@ -71,10 +71,10 @@ export function createShikiInternalSync(options: HighlighterCoreOptions): } { ensureNotDisposed() const theme = getTheme(name) - if (_lastTheme !== name) { - _registry.setTheme(theme) - _lastTheme = name - } + // Always set the theme to ensure the registry is in sync. + // The registry has its own cache so this is not too expensive. + _registry.setTheme(theme) + _lastTheme = name const colorMap = _registry.getColorMap() return { theme,