Skip to content

Syntax highlighting (shiki)

Highlight code blocks with shiki. The plugin registers shiki as the highlight provider, backed by a single lazily-created highlighter: it is built once, and each language grammar loads on demand and is cached — no re-initialisation per code block.

Terminal window
npm install @aparte/plugin-shiki @aparte/core shiki

@aparte/core and shiki are peer dependencies.

import { setupShikiProvider } from '@aparte/plugin-shiki';
await setupShikiProvider({ theme: 'github-dark' });

setupShikiProvider is asyncawait it once at startup before highlighted messages render. It fills the AparteConfig.setHighlightProvider seam.

Nothing is eagerly bundled. Each grammar is dynamically imported from shiki’s bundle the first time that language appears, so you pay only for the languages you actually render. An unknown language degrades to plain text instead of throwing.