@tanstack/markdown
Version:
A tiny, fast, deterministic Markdown renderer for blogs and documentation.
20 lines • 1.31 kB
TypeScript
import type { ComponentPropsWithoutRef, ComponentType, JSX, ReactElement, ReactNode } from 'react';
import type { BlockNode, InlineNode, MarkdownInput, RenderOptions } from './types.js';
type IntrinsicElementName = keyof JSX.IntrinsicElements;
type ComponentMap = Partial<Record<string, string | ComponentType<any>>>;
export type MarkdownComponentProps<TagName extends IntrinsicElementName> = ComponentPropsWithoutRef<TagName>;
export type MarkdownComponents = Partial<{
[TagName in IntrinsicElementName]: IntrinsicElementName | ComponentType<MarkdownComponentProps<TagName>>;
}> & Record<string, string | ComponentType<any> | undefined>;
export interface MarkdownReactOptions extends RenderOptions {
components?: ComponentMap;
}
export interface MarkdownProps extends MarkdownReactOptions {
children: MarkdownInput;
}
export declare function Markdown({ children, ...options }: MarkdownProps): ReactElement;
export declare function renderMarkdownReact(input: MarkdownInput, options?: MarkdownReactOptions): ReactNode;
export declare function renderBlockReact(node: BlockNode, options?: MarkdownReactOptions, key?: string): ReactElement;
export declare function renderInlineReact(node: InlineNode, options?: MarkdownReactOptions, key?: string): ReactNode;
export {};
//# sourceMappingURL=react.d.ts.map