@ai-gui/plugin-highlight
v0.49.0
Published
Shiki code-highlighting plugin for AIGUI.
Maintainers
Readme
@ai-gui/plugin-highlight
Syntax-highlighting plugin for AIGUI, powered by Shiki. Overrides fenced code blocks with highlighted output. Async.
Install
pnpm add @ai-gui/plugin-highlightUsage
import { highlight } from "@ai-gui/plugin-highlight"
import { AIRenderer } from "@ai-gui/react"
<AIRenderer plugins={[highlight({ themes: ["github-dark"], langs: ["ts", "python"] })]} />Options
themes?: string[]— themes to load; the first is the default whenthemeis omitted.langs?: string[]— grammars to load up front, and the ones the prompt spec names to the model.loadOnDemand?: boolean— defaulttrue: a block in a language not inlangsgets its grammar loaded on first use when Shiki bundles one by that name or alias (c,toml,yaml,sh, …); a name Shiki does not know stays plain text. Setfalseto highlight onlylangs.theme?: string— theme used for rendering; defaults to the first entry ofthemes.
The plugin also carries a prompt spec asking the model to tag every fence with its language and naming the grammars that were loaded, since a block whose language is missing cannot be highlighted. Pass plugins to buildSystemPrompt to include it.
See the root README for the full plugin list.
