Only for a narrower use case. TanStack Highlight is intended for blogs and docs with known languages. Shiki remains the better choice for TextMate accuracy, VS Code compatibility, or broad language coverage.
Sugar High is an excellent smaller option for JavaScript, TypeScript, and JSX. Use TanStack Highlight when you also need isolated non-JavaScript languages, class-based compact output, embedded markup regions, Markdown adapters, or character-range decorations.
Yes. The core is synchronous and has no Node.js runtime dependency. Use selective language imports to keep the client bundle small.
Use SSR for the initial page so code is styled before hydration. Reuse the same highlighter client-side for navigations, live previews, or content loaded after hydration. See SSR and Client Rendering.
No. Documentation pipelines already know the fence language, and detection would increase size, work, and ambiguity.
The delegated language is not registered. HTML does not import JavaScript or CSS automatically. See Embedded Languages.
No. Themes are small semantic color objects. Create one directly or use a shipped isolated theme.
Yes. Token classes are stable, so bold, italic, opacity, backgrounds, and contrast adjustments belong in your stylesheet.
.th-comment { font-style: italic; }
.th-keyword { font-weight: 600; }It escapes code text and decoration values. It is not a general HTML sanitizer. Only inject HTML returned directly by the highlighter, and sanitize untrusted surrounding Markdown with your normal pipeline.
There is no grammar loading or WebAssembly initialization. Synchronous behavior keeps SSR, hydration, and Markdown transforms straightforward.
Yes. Register a LanguageDefinition with a tokenizer that returns ordered semantic ranges. See Custom Languages.
Source is escaped and preserved, but token quality targets valid documentation code. The project does not promise compiler recovery behavior or exhaustive malformed-input conformance.