import React from 'react'; import { Markdown } from './components/Markdown.tsx'; import type { MarkdownProps } from './components/Markdown.tsx'; import type { MarkdownDocumentProps } from './components/MarkdownDocument.tsx'; import type { ParserOptions } from 'comark'; export { Markdown }; export type { MarkdownProps } from './components/Markdown.tsx'; export { MarkdownDocument } from './components/MarkdownDocument.tsx'; export type { MarkdownDocumentProps } from './components/MarkdownDocument.tsx'; export { MarkdownLive } from './components/MarkdownLive.tsx'; export type { MarkdownLiveProps } from './components/MarkdownLive.tsx'; export { MarkdownClient } from './components/MarkdownClient.tsx'; export type * from 'comark'; interface DefineMarkdownComponentOptions extends ParserOptions { /** Extend an existing defined component — inherits its plugins and components. */ extends?: React.FC; /** Display name shown in React DevTools. */ name?: string; components?: Record>; /** * Additional classes for the wrapper div */ className?: string; } /** * Create a pre-configured Markdown component with default options, plugins, and components. * * Use `extends` to inherit configuration from another defined component. * * @example * ```tsx * import { defineMarkdownComponent } from '@comark/react' * import shiki from '@comark/react/plugins/shiki' * import toc from '@comark/react/plugins/toc' * * const BaseMarkdown = defineMarkdownComponent({ * name: 'BaseMarkdown', * plugins: [shiki({ themes: { light: githubLight, dark: githubDark } })], * }) * * export const ArticleMarkdown = defineMarkdownComponent({ * name: 'ArticleMarkdown', * extends: BaseMarkdown, * plugins: [toc({ depth: 3 })], * }) * ``` */ export declare function defineMarkdownComponent(config?: DefineMarkdownComponentOptions): React.FC; interface DefineMarkdownDocumentOptions { /** Extend an existing defined renderer — inherits its component mappings. */ extends?: React.FC; /** Display name shown in React DevTools. */ name?: string; components?: Record>; /** * Additional classes for the wrapper div */ className?: string; } /** * Create a pre-configured MarkdownDocument component with default component mappings. * * Use this when parsing happens separately (server, build step, API) and you want * a reusable renderer with baked-in component mappings. * * Use `extends` to inherit mappings from another defined renderer. * * @example * ```tsx * import { defineMarkdownDocumentComponent } from '@comark/react' * import Alert from './Alert' * import CodeBlock from './CodeBlock' * * export const ArticleRenderer = defineMarkdownDocumentComponent({ * name: 'ArticleRenderer', * components: { alert: Alert, pre: CodeBlock }, * }) * * // In a Server Component: * export default async function Page() { * const document = await parseMarkdown(markdown) * return * } * ``` */ export declare function defineMarkdownDocumentComponent(config?: DefineMarkdownDocumentOptions): React.FC;