npm / shiki
shiki
What changed in shiki 3 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-17.
3 breaking20 new APIs and options5 performance8 behavior and defaults35 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initshiki 429 changes
Breaking changes 2
Deprecated APIs were removed and are no longer available to developers.
Node v18 support was dropped, so developers must use a newer Node.js version.
New APIs and options 7
Adds classActiveCode to control the active-code class produced by word highlighting.
Adds a transformer for rendering line numbers.
Adds a type field to ThemedToken.
Added a Svelte renderer for stream output, enabling Shiki stream rendering in Svelte applications.
Adds the @shikijs/magic-move package for Magic Move functionality.
Adds the @shikijs/stream package for stream-based Shiki usage.
A new package, @shikijs/markdown-exit, is available for developers to use.
Performance 4
The React renderer groups tokens by line for more efficient rendering.
Tokenization reuses each regular expression's last search while processing a line.
Token split performance improvements make tokenization faster for developers using Shiki.
The @shikijs/primitive package became leaner, changing the package developers use in their projects.
Behavior and default changes 2
codeToANSI now emits an explicit color level.
Grammars and themes were updated, affecting syntax highlighting behavior and appearance.
Fixes and other changes 14
Twoslash avoids crashing when @errors nodes occur past end of file.
Repeated language loads no longer duplicate grammar injections.
The CLI falls back to text when a file or URL has no extension and no language option.
Wasm memory is disposed for lazily embedded languages.
Notations are preserved on content comment lines.
The rose-pine theme now handles split # and -- comments.
The CLI falls back to plaintext for unknown languages.
Twoslash tooltips now appear after a 200ms delay.
YAML is now guessed from frontmatter segments, improving language detection for those segments.
Correctly handles YAML comment prefixes for v3.
Fixes scroll blocking on mobile viewports.
tsModule is now forwarded to createTwoslasher, ensuring the configured TypeScript module reaches the twoslash implementation.
ANSI language now works with multiple themes.
Fixed the declaration bundle, which may improve the type information available to developers using shiki.
shiki 342 changes
Breaking changes 1
The highlighter factory is renamed from createdBundledHighlighter to createBundledHighlighter.
New APIs and options 13
Code annotations can now use [!code info] notation.
The CLI now provides list commands.
The CLI can now accept input from standard input.
transformerRenderWhitespace now supports the leading position.
Adds a format option for HTML output.
Adds classActiveCode to notation transformers for customizing active code classes.
Adds a context parameter to the twoslash filter option.
Adds a rootStyle option that can be set to false.
Adds a transformer for removing comments from transformed code.
Supports the zeroIndexed option for transformerMetaHighlight.
The embeddedLanguages alias is supported for backwards compatibility.
The CLI supports passing a remote file URL for processing.
Indent guides now support the meta.indent field.
Performance 1
Eliminates a redundant tokenization call, improving tokenization efficiency.
Behavior and default changes 6
Grammar and themes were updated, potentially changing syntax highlighting output.
codeToHast now preserves HAST data and properties.
Grammar was updated, potentially changing syntax highlighting behavior.
Monaco theme tokenScopes are normalized, with tighter Monaco type imports.
Grammars were updated, which may change syntax highlighting behavior.
Grammars and themes were updated, potentially changing syntax highlighting output.
Fixes and other changes 21
Top-level declarations in .d.ts files now receive the declare modifier.
CLI language and extension inputs are normalized for casing.
Promise rejections during lazy language loading are now handled.
Popper positions are no longer recomputed too early within VitePress code groups.
Registry dependency checks now account for embeddedLanguages.
Monaco now correctly handles sparse color map updates.
Adds typesVersions to support legacy module resolution.
langAlias can now be used with special languages.
dimColor now correctly parses 4-digit hex colors.
String utilities now handle edge cases more robustly.
The Monaco integration now updates its color map correctly when themes switch.
Markdown font styles are preserved in Monaco output.
The PlainTextLanguage type now includes plain as a valid language.
The rose-pine theme correctly handles multi-token comments.
A typo in twoslash-query-persisted is fixed.
Decorations are enabled for inline structures.
The matcher now supports comment-prefixed [code . highlight] markers.
Missing theme ANSI colors now fall back instead of remaining unavailable.
A singleton highlighter can now recover after an invalid language error.
Dragging no longer triggers popper show or hide behavior.
The default color now works correctly with colorized-brackets.