import { default as React } from 'react'; import { ParseOptions } from './parser'; export interface MarkdownProps { /** * The markdown content to be rendered. * @example * ```md * # Hello World * * This is a **markdown** paragraph with [links](https://example.com) * ``` */ content: string; /** * Configuration options for the markdown parser. * Includes component overrides, hooks, and global styling. * @optional */ options?: ParseOptions; /** * Additional CSS class names to be applied to the container. * @optional */ className?: string; /** * Custom styles to be applied to the container. * @optional */ style?: React.CSSProperties; /** * Whether to wrap the content in an article element instead of a div. * Recommended for semantic HTML when rendering full articles or blog posts. * @default false * @optional */ asArticle?: boolean; /** * Custom ID to be applied to the container. * @optional */ id?: string; /** * Additional accessibility attributes for the container. * @optional */ aria?: { /** Accessible label for the container. */ label?: string; /** ID of the element that describes this container. */ describedBy?: string; }; } /** * A ultra-lightweight React component that renders markdown content with a token-based React renderer. * * Key Features: * - Token-based rendering (No `dangerouslySetInnerHTML`) * - GitHub-style alerts (`> [!NOTE]`) * - Footnote support (`[^1]`) * - Mathematical blocks (`$$`) and inline math (`$`) * - Advanced component overrides via the `components` prop. * * @example * ```tsx * import Markdown from "markdown-parser-react"; * * // Basic usage * * * // Advanced usage with component overrides and hooks *

{children}

, * a: (props) => * }, * onRenderMath: (content, isBlock) => ( * * ) * }} * asArticle={true} * /> * ``` * @remarks * This library is open source under the MIT license. Support and customization * are available through [Code Media Labs](https://codemedialabs.in). */ export declare function Markdown({ content, options, className, style, asArticle, id, aria, }: MarkdownProps): React.JSX.Element; export declare const defaultStyles = "\n.markdown-container {\n font-family: system-ui, -apple-system, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n line-height: 1.6;\n color: #1f2328;\n max-width: 100%;\n}\n.markdown-container h1, .markdown-container h2 {\n border-bottom: 1px solid #d0d7de;\n padding-bottom: 0.3em;\n margin-top: 1.5em;\n}\n.markdown-container a {\n color: #0969da;\n text-decoration: none;\n}\n.markdown-container a:hover {\n text-decoration: underline;\n}\n.markdown-container img {\n max-width: 100%;\n height: auto;\n border-radius: 6px;\n}\n.markdown-container pre {\n overflow-x: auto;\n padding: 16px;\n background-color: #f6f8fa;\n border-radius: 6px;\n font-size: 85%;\n line-height: 1.45;\n}\n.markdown-container code {\n padding: 0.2em 0.4em;\n margin: 0;\n font-size: 85%;\n background-color: rgba(175, 184, 193, 0.2);\n border-radius: 6px;\n font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;\n}\n.markdown-container pre code {\n background-color: transparent;\n padding: 0;\n}\n.markdown-container blockquote {\n border-left: 0.25em solid #d0d7de;\n margin: 0;\n padding: 0 1em;\n color: #636c76;\n}\n.markdown-container table {\n border-spacing: 0;\n border-collapse: collapse;\n margin-top: 0;\n margin-bottom: 16px;\n width: 100%;\n}\n.markdown-container table th, .markdown-container table td {\n padding: 6px 13px;\n border: 1px solid #d0d7de;\n}\n.markdown-container table tr {\n background-color: #ffffff;\n border-top: 1px solid #d0d7de;\n}\n.markdown-container table tr:nth-child(2n) {\n background-color: #f6f8fa;\n}\n.markdown-container .task-list-item {\n list-style-type: none;\n}\n.markdown-container .task-list-item input[type=\"checkbox\"] {\n cursor: pointer;\n width: 1.2rem;\n height: 1.2rem;\n margin: 0.2rem 0.5rem 0 0;\n accent-color: #0969da;\n flex-shrink: 0;\n}\n.markdown-container .markdown-alert {\n padding: 1rem 1rem 1rem 1.25rem;\n margin-bottom: 16px;\n color: inherit;\n border-left: 0.25em solid #d0d7de;\n border-radius: 6px;\n}\n.markdown-alert > *:last-child {\n margin-bottom: 0;\n}\n.markdown-alert > *:first-child {\n margin-top: 0;\n}\n.markdown-alert-note { border-left-color: #0969da !important; background-color: #f0f7ff; }\n.markdown-alert-tip { border-left-color: #1a7f37 !important; background-color: #f0fff4; }\n.markdown-alert-important { border-left-color: #8250df !important; background-color: #f8f5ff; }\n.markdown-alert-warning { border-left-color: #9a6700 !important; background-color: #fff8ec; }\n.markdown-alert-caution { border-left-color: #cf222e !important; background-color: #fff1f0; }\n\n.markdown-container .math-block {\n overflow-x: auto;\n padding: 1rem 0;\n font-size: 110%;\n}\n.markdown-container .task-list-item input[type=\"checkbox\"] {\n cursor: pointer;\n width: 1.1em;\n height: 1.1em;\n accent-color: #0969da;\n}\n.markdown-container .footnotes {\n font-size: 0.85em;\n color: #636c76;\n margin-top: 2rem;\n}\n"; export default Markdown;