npm / shiki
shiki
What changed in shiki 1 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
26 breaking2 deprecations50 new APIs and options7 performance15 behavior and defaults1 tooling47 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initshiki 436 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 6
Rendering many decorations now takes linear time.
The Wasm binary is gzip-compressed and loaded asynchronously.
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 19
The rehype integration avoids cache key collisions between code blocks.
The vitepress-twoslash drag guard continues to work with floating-vue 5.4.
Injections loaded after their target grammar are now applied.
Single-theme inline token styles are now also converted to classes.
Tokenizer offsets and CRLF handling now align with codeToTokens.
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 347 changes
Breaking changes 3
The highlighter factory is renamed from createdBundledHighlighter to createBundledHighlighter.
The default twoslash moduleResolution changed to bundler.
TypeScript resolution support for node10 was removed.
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 24
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.
Transformers now support matching comments in comments.
Transformers also remove the extra newline token.
Matching indices for word-highlight were fixed.
shiki 214 changes
Breaking changes 8
The function now requires a single object-style argument.
createHighlighterCore now requires an engine field, replacing the loadWasm field.
Import FontStyle from @shikijs/vscode-textmate instead of @shikijs/core.
The loadWasm field in createHighlighterCore is replaced with the engine field; WASM engine imports are available from dedicated engine paths.
Import loadWasm and createOnigurumaEngine from the engine-specific path instead of the main package or @shikijs/core.
The regex engine APIs are no longer included; import them from their engine packages instead.
The WASM inline import path is replaced by @shikijs/engine-oniguruma/wasm-inline.
Import StackElementMetadata from @shikijs/vscode-textmate instead of @shikijs/core.
Deprecations 2
The API is deprecated in favor of createHighlighter, a naming correction with no functional change.
The compatibility package for v0.14 is deprecated; migrate to the main package before it is removed in v3.0.
New APIs and options 1
The JavaScript engine is re-exported from an engine-specific import path.
Behavior and default changes 2
Shiki now emits runtime warnings for deprecated APIs by default, helping developers prepare for their removal in v3.0.
The option lets transformer users choose the matching algorithm; its default is planned to change from v1 to v3 in v3.0.0, so set it explicitly to avoid a future breaking change.
Tooling 1
Run the community codemod to automate most API changes when migrating from v1 to v2.
shiki 151 changes
Breaking changes 13
Unifies codeToHtmlThemes with codeToHtml, using hast.
Renames codeToHtmlDualThemes and is then unified into codeToHtml.
The options accepted by codeToThemedTokens change.
Replaces the codeToThemedTokens API.
Default themes and languages are no longer included.
The hastTransform hook is reworked as transforms.
The deprecated highlightLines option is disabled in the rehype and markdown-it integrations.
Language registration is flattened, and the languages/ path is shortened to langs/.
The highlightLines option is deprecated and disabled.
Renames the renderer hook nodeCompletions to nodeCompletion.
The highlightLines option is deprecated and disabled.
Renderers are removed.
The transformer hook is renamed to span.
New APIs and options 29
Adds addClassToHast to transformer context.
The compat package supports ansiToThemedTokens.
The TwoSlash transformer supports configuring its cache option.
Adds codeToHast as a utility in transformer context.
Adds an API for converting code to tokens.
Supports passing includeExplanation.
Theme objects support arbitrary color values and a colorReplacements field.
Introduces an API for decorating highlighted code, applying full-line decorations when possible.
VitePress supports a custom explicitTrigger.
The compat package supports getBackgroundColor.
The compat package supports getForegroundColor.
Supports grammar injection.
The highlighter can be initialized without themes or languages.
Adds lang to HtmlRendererOptions.
Language aliases are supported.
Language aliases are supported.
The compat API supports loading a theme from disk.
Adds a mergeWhitespaces option for HTML and supports the value never for themes that do not handle whitespace perfectly.
Languages can be loaded multiple at once.
Adds a special none theme.
Themed tokens now provide offset information.
Adds preprocess and postprocess hooks to transformers; preprocess is also called in codeToHast.
Adds an onError option.
Supports a custom parseMetaString function.
The render-whitespace transformer supports a position option.
Adds a tokens hook to transformers.
Exports tokensToHast.
Introduces a transformer for metadata-based highlighting.
Adds two transformers for word highlighting, including highlighting across multiple tokens.
Behavior and default changes 5
Its return type is improved.
Twoslash adds completion on string quotes and literals, and on multifile input.
Twoslash completion supports multifile input.
Shiki no longer depends on the filesystem and works across Node.js, browsers, and other modern runtimes.
Provides full ESM support and no longer needs static assets or CDN settings.
Fixes and other changes 4
The compat package improves the codeToHtml type.
The plain language is treated as plain text.
The text language is always allowed by the types.
Word highlighting supports any symbol.