/** * Renders code with the CSS Custom Highlight API when available, falling * back to HTML generation — * https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API * * Requires importing `theme_highlight.css` instead of `theme.css`. */ import type { Snippet } from 'svelte'; import type { SvelteHTMLElements } from 'svelte/elements'; import type { SyntaxStyler } from './syntax_styler.js'; import { type HighlightMode } from './highlight_manager.js'; type $$ComponentProps = SvelteHTMLElements['code'] & { /** The source code to syntax highlight. */ content: string; /** * Language identifier (e.g. 'ts', 'css', 'html', 'json', 'svelte', 'md'). * Selects the registered lexer and sets the `data-lang` attribute. `null` * disables highlighting (content renders as plain text); `undefined` * falls back to the default ('svelte'). * * @default 'svelte' */ lang?: string | null; /** * Highlighting mode: `'auto'` uses the CSS Custom Highlight API when * supported and falls back to HTML, `'ranges'` forces the Highlight API * (requires browser support), `'html'` forces HTML generation with CSS * classes. The Highlight API has limited browser support and requires * `theme_highlight.css` instead of `theme.css`. * * @default 'auto' */ mode?: HighlightMode; /** * Whether to render as inline code instead of a block. * * @default false */ inline?: boolean; /** * Whether to wrap long lines in block code (`white-space: pre-wrap` * instead of `pre`). Wraps at whitespace — long unbroken tokens (URLs, * hashes) still scroll horizontally. Ignored for inline code. * * @default false */ wrap?: boolean; /** * Custom `SyntaxStyler` instance, e.g. with different languages registered. * * @default syntax_styler_global */ syntax_styler?: SyntaxStyler; /** * Optional snippet to customize how the highlighted markup is rendered. * - In HTML mode: receives the generated HTML string * - In range mode: receives the plain text content */ children?: Snippet<[markup: string]>; }; declare const CodeHighlight: import("svelte").Component<$$ComponentProps, {}, "">; type CodeHighlight = ReturnType; export default CodeHighlight; //# sourceMappingURL=CodeHighlight.svelte.d.ts.map