Modern JavaScript libraries for syntax highlighting code blocks in docs, blogs, and web apps.
This list focuses on projects that are both widely used and actively maintained.

## Quick recommendation

- Use **[Shiki](https://shiki.style/)** for static docs and SSR output with VS Code-like quality.
- Use **[Prism](https://prismjs.com/)** when you need a lightweight client-side highlighter with many plugins.
- Use **[Highlight.js](https://highlightjs.org/)** for easy setup and automatic language detection.
- Use **[@wooorm/starry-night](https://github.com/wooorm/starry-night)** if you want GitHub-style highlighting based on TextMate grammars.
- Use **[Sugar High](https://github.com/huozhi/sugar-high)** only for minimal JS/JSX snippets where tiny bundle size matters.

## Maintained packages (snapshot 2026-04-10)

| Package | Best for | Maintenance signal | Notes |
| --- | --- | --- | --- |
| [Shiki](https://shiki.style/) | SSG/SSR docs, MDX pipelines | npm `4.0.2`, updated `2026-03`; repo active (`2026-03`) | High accuracy (TextMate + VS Code themes), strong for build-time highlighting |
| [Prism](https://prismjs.com/) | Browser-side highlighting | npm `1.30.0`, updated `2025-03`; repo active (`2026-04`) | Lightweight and extensible ecosystem |
| [Highlight.js](https://highlightjs.org/) | Auto-detection and quick integration | npm `11.11.1`, updated `2025-08`; repo active (`2025-10`) | Mature, very widely adopted |
| [@wooorm/starry-night](https://github.com/wooorm/starry-night) | GitHub-like rendering | npm `3.9.0`, updated `2026-01`; repo active (`2026-01`) | High-fidelity tokenizer, good for Markdown tooling |
| [refractor](https://github.com/wooorm/refractor) | Prism AST output (rehype/unified) | npm `5.0.0`, updated `2025-03`; repo active (`2025-03`) | Better if you need syntax tree output, not raw HTML strings |
| [lowlight](https://github.com/wooorm/lowlight) | highlight.js AST output | npm `3.3.0`, updated `2024-12`; repo active (`2024-12`) | Good with virtual DOM and unified pipelines |
| [Sugar High](https://github.com/huozhi/sugar-high) | Tiny JS/JSX snippets | npm `1.1.0`, updated `2026-04`; repo active (`2026-04`) | Extremely small footprint, narrower language scope |

## Notes

- For full in-browser editing (not just highlighting), see [Embeddable editors](../embeddable-editors).
- If you need deterministic output for docs, prefer **build-time** highlighting (Shiki / starry-night) over runtime highlighting.

## Sources

- [Shiki documentation](https://shiki.style/) — project scope and capabilities (accessed 2026-04-10)
- [Prism website](https://prismjs.com/) — project scope and plugin ecosystem (accessed 2026-04-10)
- [Highlight.js website](https://highlightjs.org/) — project scope and usage model (accessed 2026-04-10)
- [npm: shiki](https://www.npmjs.com/package/shiki), [npm: prismjs](https://www.npmjs.com/package/prismjs), [npm: highlight.js](https://www.npmjs.com/package/highlight.js), [npm: @wooorm/starry-night](https://www.npmjs.com/package/@wooorm/starry-night), [npm: refractor](https://www.npmjs.com/package/refractor), [npm: lowlight](https://www.npmjs.com/package/lowlight), [npm: sugar-high](https://www.npmjs.com/package/sugar-high) — latest version and last modified date (accessed 2026-04-10)
- [GitHub: shikijs/shiki](https://github.com/shikijs/shiki), [PrismJS/prism](https://github.com/PrismJS/prism), [highlightjs/highlight.js](https://github.com/highlightjs/highlight.js), [wooorm/starry-night](https://github.com/wooorm/starry-night), [wooorm/refractor](https://github.com/wooorm/refractor), [wooorm/lowlight](https://github.com/wooorm/lowlight), [huozhi/sugar-high](https://github.com/huozhi/sugar-high) — repository activity and popularity signals (accessed 2026-04-10)