Packages

@shikijs/transformers

4.6.0 · 2 Nov 2026MIT8.4M / weekRepositoryHomepagenpmAtom feed

Your version

1.0.0

major7 Feb 2024Where it was published

1.29.2 is the newest release of 1.x.

In short

20 breaking1 deprecated102 new5 faster69 fixed3 internal

  • Breaking

    Flat lang registration

  • Breaking

    Shorten languages/ to langs/

  • Breaking

    Change codeToThemedTokens options

  • Breaking

    Rename codeToHtmlDualThemes to codeToHtmlThemes

  • Breaking

    Use hast, unify codeToHtmlThemes to codeToHtml

  • Breaking

    Rework hastTransform to transforms

  • Breaking

    Improve return type of codeToTokensWithThemes, close #37

  • Breaking

    Add unwasm condition in exports

Release note

Shiki v1.0 is a major rewrite that solves most of the long-lasting issues. Previously known as Shikiji, now it's merged back to Shiki.

👉 Migration Guide

Notable Highlights

Generated Changelog

Breaking Changes

  • Breaking

    Flat lang registration

  • Breaking

    Shorten languages/ to langs/

  • Breaking

    Change codeToThemedTokens options

  • Breaking

    Rename codeToHtmlDualThemes to codeToHtmlThemes

  • Breaking

    Use hast, unify codeToHtmlThemes to codeToHtml

  • Breaking

    Rework hastTransform to transforms

  • Breaking

    Improve return type of codeToTokensWithThemes, close #37

  • Breaking

    Add unwasm condition in exports

  • Breaking

    Remove deprecated APIs

  • Breaking

    Consistent case of Twoslash

  • Breaking

    Rename to shiki

  • Breaking

    Remove renderers

  • Breaking

    Merge Shikiji back into Shiki for v1.0

  • Breaking

    Remove all deprecated APIs

  • Breaking

    Refactor internal context

  • Breaking

    core: Rename transformer hook token to span to avoid confusion

  • Deprecated

    markdown-it: Deprecate and disable highlightLines option

  • Deprecated

    rehype: Deprecate and disable highlightLines option

  • Breaking

    twoslash: Improve rich renderer

  • Breaking

    twoslash: Move to twoslash package for better performance and composablity

  • Breaking

    twoslash: Rename renderer hook nodeCompletions to nodeCompletion

  • Breaking

    twoslash: Support highlight

Features

  • Rewrite from shiki

  • Types for each export

  • Improve types

  • Auto module default resolution

  • Improve module resolution

  • Bundle include embedded languages

  • Provide singleton shorthands

  • Add codeToHtmlDualThemes

  • Support multiple themes for renderToHtmlDualThemes

  • Support no default color for dual themes, #6

  • Add codeToTokensWithThemes, fix #7

  • Port back ansi support

  • Add rehype and markdown-it plugins

  • Wip shikiji-compact package

  • Support passing raw theme object on generation

  • Improve compatibility

  • Improve compat

  • Support font-style for multiples themes

  • Support lang on the meta

  • Treat plain as plain text, close #24

  • Support multiple transformers

  • Introduce transformers package

  • Add preprocess and postprocess hooks to transformer

  • Support lang alias

  • Introduce twoslash transformer

  • Expose more utils

  • Additional codeToHast util in transformer context

  • Adjust css

  • New shikiji-core package, improve bundling

  • Introduce shikiji-monaco package

  • Provide more info for languages and themes

  • Support grammar injection

  • Change source from shiki to tm-grammars and tm-themes

  • Introduce web bundle

  • Introduce lazy embedded, more efficient bundle

  • Call preprocess hook in codeToHast

  • Introduce shikiji-cli

  • Support arbitrary colors value in theme, support colorReplacements field

  • Support mergeWhitespaces: never for themes are not handling perfectly

  • Update deps, a few new themes

  • Improve wasm support

  • Also support wasm import module

  • Support also passing promises to loadWasm

  • Support angular

  • Introduce vitepress-plugin-twoslash

  • Support unwasm condition for core

  • Support configure cache option for twoslash transformer

  • Upgrade to twoslash v0.1.0

  • Add a special none theme

  • Support ansi background color, fix #432

  • Add fortran support

  • Export tokensToHast

  • Support passing includeExplanation, close #568

  • Add codeToTokens API, rename codeToThemedTokens to codeToTokensBase

  • Add addClassToHast to transformer context

  • Introduce Decorations API

  • Apply full line decoration when possible

  • compat: Support lineOptions

  • core: Provide offset info in themed token

  • core: Introduce tokens hook to transformers

  • html: Add mergeWhitespaces option, thanks to @dominikg

  • markdown-it: Support fine-grain usage

  • rehype: Custom parseMetaString

  • rehype: Support fine-grain integration, close #64

  • rehype: Add onError option, close #64

  • rehype-shikiji: Add language class to code element

  • rehype-shikiji: Add custom cache option

  • rehype-shikiji: Support metastring from node.properties

  • transformers: Nations support range

  • transformers: render-whitepsace support position option

  • transformers: Introduce transformerMetaHighlight transformer

  • transformers: Two new transformers for word highlighting

  • transformers: Support word highlighting across multiple tokens

  • transforms: Add line node element to token transformer

  • twoslash: Support custom renderer

  • twoslash: Support passing explicit trigger in markdown-it and rehype integration

  • twoslash: Expose core module, independent from twoslash

  • twoslash: Expose twoslasher option to be override

  • twoslash: Add classExtra to rich renderer

  • twoslash: Allow provide custom trigger

  • twoslash: Allow lossy custom twoslash implementation

  • twoslash: Support errorRendering to render error in hover style

  • twoslash: Support extend popupError

  • twoslash: Wrap tokens in a single span for errors

  • twoslash/rich: Improve styling

  • twoslash/rich: Renders jsdoc

  • twoslash/rich: Support overriding lang

  • twoslash/rich: Support processHoverInfo and processHoverDocs hook

  • vitepress: Make classes configurable

  • vitepress: Improve jsdocs handling

  • vitepress: Support errorRendering hover

  • vitepress-twoslash: Support floating-vue for completions

  • vitepress-twoslash: Support rendering jsdoc tags

Bug Fixes

  • Oniguruma options

  • Make cf working

  • Rename APIs

  • Add type export

  • .d.mts for all

  • Allow loading multiple langs at once

  • Subpackages dts in node10

  • Support language alias

  • Types

  • Langs subpackage dts in node10

  • Do not include any default themes/languages

  • Improve type exchangeability

  • Allow to init the highlighter without themes and langs

  • Remove empty style

  • Add lang to HtmlRendererOptions

  • Revert #26, fix #30

  • Improve transformers

  • Improve types

  • Improve types in ThemeRegistration

  • Load all embedded langs with markdown

  • Improve ThemeRegistration type, close #63

  • Avoid merge style when visible styles are applied, close #65

  • Improve css variable handling for background

  • MergeWhitespaceTokens offset calculation

  • Improve error handling

  • Update grammar registry, fix html in markdown highlighting

  • Stricter types

  • SplitLines extra new lines, fix #576

  • compact: Improve types export

  • compat: Improve codeToHtml type

  • compat: Support loadTheme from disk

  • compat: Support ansiToThemedTokens

  • compat: Support getBackgroundColor and getForegroundColor

  • compat: Do not re-export enum

  • core: GetHighlighter type inference, close #50

  • core: Dts naming conflicts

  • core: Sub export types, fix #566

  • dual-theme: Respect users' explicit options

  • markdown-it: Prepend builtin transformers, close #40

  • markdown-it: Improve types compactible with legacy resolution, close #44

  • monaco: Convert tmTheme to monacoTheme

  • rehype-shikiji: Lazily initialize promise

  • transformers: Improve RenderWhitespace handling

  • transformers: Make transformers works well together

  • transformers: Improve boundary mode of rendering spaces

  • transformers: Word highlight support any symbol, fix #110

  • twoslash: Fix popover offset calculation

  • twoslash: Avoid deps on typescript runtime

  • twoslash: Should not throw when throws: true

  • twoslash: Split tokens to match the twoslash nodes

  • twoslash: Support targeting multiple tokens a node, more accurate result

  • twoslash: Avoid genreate duplicate hovers

  • twoslash: Respect twoslash output lang

  • twoslash: Completion on string quotes and literals

  • twoslash: Completion on multifile

  • twoslash: Adjust styles

  • twoslash: Split tokens on completion

  • twoslash: Improve css variables definition

  • twoslash: Improve types

  • twoslash/rich: Improve default css style

  • types: Allways allow text lang

  • vitepress: Improve class handing, reduce html payload size

  • vitepress: Css style

  • vitepress: Fix types

  • vitepress: Support custom explicitTrigger

  • vitepress-plugin-twoslash: Improve tooltip experience

  • vitepress-plugin-twoslash: Disable triggers for presistented popover

  • vitepress-plugin-twoslash: Fix floating jump

  • vitepress-twoslash: Separate CSS deps, close #86

  • vitepress-twoslash: Popup arrow color

  • vitepress-twoslash: Escape Vue syntax

  • vitepress-twoslash: Improve tabs experience

  • vitepress-twoslash: Fix class override

Performance

  • Optimize internal logic

  • Cleanup unused attribute in themes and langs

  • Skip setTheme if theme hasn't changed

  • cli: Use Promise.all

  • vitepress: Add v-pre to docs

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.