UNPKG

@kitn.ai/ui

Version:

Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. Authored in SolidJS.

24 lines (23 loc) 1.25 kB
type Loader = () => Promise<unknown>; export interface CodeHighlightingOptions { /** Turn highlighting on/off globally. When false, code renders as plain text. */ enabled?: boolean; /** Register/override language loaders, e.g. `{ ruby: () => import('@shikijs/langs/ruby') }`. */ languages?: Record<string, Loader>; /** Register/override theme loaders. */ themes?: Record<string, Loader>; /** Map short names to canonical language keys, e.g. `{ vue: 'html' }`. */ aliases?: Record<string, string>; } /** * Highlight `code` as `lang` with `theme`, returning HTML. Loads only what's * needed, on demand. Falls back to escaped plain `<pre><code>` when highlighting * is disabled, the language has no registered loader, or anything fails. */ export declare function highlight(code: string, lang: string, theme: string): Promise<string>; /** Register additional languages/themes/aliases, or disable highlighting entirely. */ export declare function configureCodeHighlighting(options: CodeHighlightingOptions): void; export declare function isCodeHighlightingEnabled(): boolean; /** Test helper — reset the singleton and registries to defaults. */ export declare function __resetCodeHighlightingForTests(): void; export {};