Syntax highlighting transform plugin for the Nous pipeline, powered by Shiki.
npm install @nousdev/plugin-shikiimport { createShikiPlugin } from '@nousdev/plugin-shiki';
const plugin = createShikiPlugin({
theme: 'github-dark',
darkTheme: 'github-dark-dimmed',
languages: ['typescript', 'python', 'bash'],
});
// Register with the Nous build pipeline
const result = await buildAll({
// ...
plugins: [plugin],
});The plugin walks the NDM tree during the transform phase, locates codeBlock nodes with a language annotation, and injects pre-rendered highlighted HTML via Shiki. The raw value is preserved for copy-to-clipboard and AI indexing.
Language grammars are loaded on demand with deduplication to prevent race conditions during concurrent highlighting.
Returns a Nous transform plugin that applies Shiki syntax highlighting to all code blocks in the document tree.
| Option | Type | Default | Description |
|---|---|---|---|
theme |
string? |
'github-dark' |
Shiki theme for syntax highlighting |
darkTheme |
string? |
-- | Optional second theme for dual-theme rendering |
languages |
string[]? |
All bundled | Restrict which language grammars to load. Unlisted languages render as plain text. |
Shiki supports all languages bundled with TextMate grammars. Refer to the Shiki languages list for available identifiers.
@nousdev/typesshiki
This package is part of Nous, an adaptive documentation infrastructure that transforms Markdown into agent-ready knowledge.
MIT