import { default as React, CSSProperties } from 'react'; export interface CustomClasses { headings?: string; paragraphs?: string; lists?: string; blockquotes?: string; codeBlocks?: string; tables?: string; links?: string; images?: string; footnotes?: string; footnoteReference?: string; orderedLists?: string; unorderedLists?: string; listItems?: string; } export interface CustomStyles { headings?: CSSProperties; paragraphs?: CSSProperties; lists?: CSSProperties; blockquotes?: CSSProperties; codeBlocks?: CSSProperties; tables?: CSSProperties; links?: CSSProperties; images?: CSSProperties; footnotes?: CSSProperties; footnoteReference?: CSSProperties; orderedLists?: CSSProperties; unorderedLists?: CSSProperties; listItems?: CSSProperties; } /** * Custom components to override default markdown elements. */ export interface CustomComponents { h1?: React.ComponentType; h2?: React.ComponentType; h3?: React.ComponentType; h4?: React.ComponentType; h5?: React.ComponentType; h6?: React.ComponentType; p?: React.ComponentType; ul?: React.ComponentType; ol?: React.ComponentType; li?: React.ComponentType; dl?: React.ComponentType; dt?: React.ComponentType; dd?: React.ComponentType; blockquote?: React.ComponentType; code?: React.ComponentType; pre?: React.ComponentType; table?: React.ComponentType; thead?: React.ComponentType; tbody?: React.ComponentType; tr?: React.ComponentType; th?: React.ComponentType; td?: React.ComponentType; a?: React.ComponentType; img?: React.ComponentType; del?: React.ComponentType; sup?: React.ComponentType; sub?: React.ComponentType; mark?: React.ComponentType; strong?: React.ComponentType; em?: React.ComponentType; math?: React.ComponentType<{ content: string; isBlock: boolean; }>; alert?: React.ComponentType<{ type: string; children: React.ReactNode; }>; footnoteReference?: React.ComponentType<{ id: string; label: string; }>; footnoteDefinition?: React.ComponentType<{ id: string; children: React.ReactNode; }>; } /** * Options for parsing markdown content. */ export interface ParseOptions { /** * Prefix for language-specific code block classes. * @example "language-" */ langPrefix?: string; /** * Custom CSS classes for different markdown elements. */ customClasses?: CustomClasses; /** * Custom CSS styles for different markdown elements. */ customStyles?: CustomStyles; /** * Target attribute for links. * @default "_blank" */ linkTarget?: "_blank" | "_self" | "_parent" | "_top"; /** * Whether to sanitize HTML content. * @default false */ sanitizeHtml?: boolean; /** * Maximum allowed nesting level for lists. * @default 6 */ maxNestingLevel?: number; /** * Custom components to override default markdown elements. */ components?: CustomComponents; /** * Callback for rendering math content. * If provided, this function will be called for both inline ($) and block ($$) math. * @param content - The raw math content (TeX/LaTeX). * @param isBlock - Whether the math is a block-level element ($$). */ onRenderMath?: (content: string, isBlock: boolean) => React.ReactNode; /** * Callback for custom syntax highlighting. * If provided, this function will be called for all code blocks (```). * @param code - The raw code content. * @param language - The language identifier (e.g. "javascript", "python"). */ onRenderCode?: (code: string, language?: string) => React.ReactNode; } /** * Modern token-based markdown parser for React. * * This function performs a two-pass scan on the input markdown: * 1. Scans for footnote definitions (`[^1]:`) and hoists them. * 2. Parses the content into a tree of React components without using `dangerouslySetInnerHTML`. * * Support is included for: * - GitHub Alerts (`> [!NOTE]`) * - Footnotes (`[^1]`) * - Math (inline and block) * - Tables, Code Blocks, Task Lists, and more. * * @param markdown - The raw markdown string. * @param options - Configuration for styling and component overrides. * @returns An array of uniquely keyed React fragments/nodes. */ export declare function parse(markdown: string, options?: ParseOptions, depth?: number): React.ReactNode[];