@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.
40 lines (39 loc) • 1.42 kB
TypeScript
/**
* Default HTML tag renderer registry.
*
* Maps every supported HTML tag name (e.g. `'div'`, `'span'`) to its
* corresponding Svelte component. The map is used by `SvelteMarkdown`
* when rendering raw HTML blocks embedded in markdown.
*
* Use the `allowHtmlOnly` / `excludeHtmlOnly` helpers (or replace
* individual entries with `null`) to restrict which tags are rendered.
*
* @module
*/
import type { Component } from 'svelte';
import UnsupportedHTML from './_UnsupportedHTML.svelte';
/**
* Record type mapping HTML tag names to their Svelte renderer components.
*
* A `null` value means the tag is explicitly blocked and will not be
* rendered. This interface is used by the allow/deny filter utilities.
*/
export interface HtmlRenderers {
[key: string]: Component<any, any, any> | null;
}
/**
* Default map of every supported HTML tag to its renderer component.
*
* Passed as the `html` key of `defaultRenderers`. Override individual
* entries via the `renderers.html` prop on `SvelteMarkdown`.
*/
export declare const Html: HtmlRenderers;
export default Html;
/**
* Placeholder component rendered in place of HTML tags that have been
* blocked via `excludeHtmlOnly`, `allowHtmlOnly`, or `buildUnsupportedHTML`.
*
* Renders the tag name and content as plain, escaped text so the user can
* see that a tag was present but intentionally suppressed.
*/
export { UnsupportedHTML };