@humanspeak/svelte-markdown
Version:
Markdown and HTML renderer for Svelte 5 — built for rendering streaming AI agent output from Claude Code, ChatGPT, and agentic workflows. XSS-safe defaults, streaming-aware sanitization, token caching, TypeScript types, and Svelte 5 runes.
27 lines (26 loc) • 1.09 kB
TypeScript
import type { Snippet } from 'svelte';
import type { SvelteMarkdownOptions } from '../types.js';
interface Props {
depth: number;
raw: string;
text: string;
options: SvelteMarkdownOptions;
slug: (val: string) => string;
children?: Snippet;
}
/**
* Renders a markdown heading (`# … ######`) as an `<h1>` through `<h6>` element.
*
* When `options.headerIds` is `true`, an `id` attribute is generated from the
* heading text via `github-slugger`, optionally prefixed by `options.headerPrefix`.
*
* @prop {number} depth - Heading level (1–6).
* @prop {string} raw - Original markdown source of the heading line.
* @prop {string} text - Plain-text content used for slug generation.
* @prop {SvelteMarkdownOptions} options - Parser options (controls ID generation).
* @prop {(val: string) => string} slug - Slugger function for generating heading IDs.
* @prop {Snippet} [children] - Rendered inline content of the heading.
*/
declare const Heading: import("svelte").Component<Props, {}, "">;
type Heading = ReturnType<typeof Heading>;
export default Heading;