The code components use a shared Shiki highlighter singleton to avoid creating multiple instances. Set up a single instance for your application:
Shared Highlighter#
The code-themes package exports a getHighlighter() function that creates a singleton instance. Both CodeSnippet and CodeEditor use it internally, but you can also use it directly for custom highlighting.
Server-Side Highlighting#
For RSC or build-time highlighting, create a server-only wrapper around the same singleton:
Numscript Examples#
Multiple snippets sharing the same singleton — no extra instances created.
CSS Variables#
Syntax colors are defined as CSS custom properties so they automatically follow your theme. Override any token in your global CSS: