Shiki

shiki.style

Beautiful syntax highlighter using TextMate grammars and VS Code themes.

Overview

Shiki is a syntax highlighter built on TextMate grammars, the same engine that powers VS Code. It provides accurate and beautiful code highlighting with zero runtime overhead—all highlighting is performed at build time, allowing you to ship zero JavaScript while maintaining perfect syntax highlighting.

The tool is highly customizable with a HAST-based architecture that supports addons and transformations. Shiki is fully tree-shakable ESM and runs universally across any JavaScript runtime, including browsers, Node.js, Cloudflare Workers, and more.

Key features

  • TextMate grammar support
  • Zero runtime JavaScript
  • Build-time highlighting
  • HAST-based architecture
  • Customizable transformations
  • ESM and tree-shakable
  • Universal JavaScript runtime support
  • Dual theme support
Pros
  • Accurate syntax highlighting matching VS Code
  • No runtime performance overhead
  • Highly customizable with addons and transformations
  • Works across all JavaScript environments
  • Lightweight and tree-shakable
Cons
  • Requires build-time processing
  • Learning curve for custom themes and languages
Use this if
You need accurate, beautiful syntax highlighting with zero runtime cost, want to customize highlighting behavior, or need to highlight code across multiple JavaScript environments.
Skip this if
You need client-side dynamic syntax highlighting without a build step, or require real-time code highlighting in the browser.

Best for

Code documentationBlog posts with code examplesDeveloper websitesStatic site generationBuild-time code highlighting

Alternatives

Highlight.jsPrism.jsPygmentsRouge

Compare Shiki alternatives

More Library

Compare all
View React Query
React Query

Data-fetching and state management library designed to handle server state in web applications.

View dotenv
dotenv

Zero-dependency module loading environment variables from .env files into Node.js apps.

View Solidjs
Solidjs

JavaScript library designed for building user interfaces with a focus on declarative syntax and efficiency.

View UnoCSS
UnoCSS

Instant on-demand atomic CSS engine — flexible, fast alternative to Tailwind.