import type { Node, ElementNode, MarkdownDocument } from 'comark'; import type { RendererOptions } from 'comark/render'; export * from 'comark/render'; export interface RenderHTMLContext { /** Renders the element's children to HTML */ render: (children: Node[]) => Promise; /** Frontmatter/metadata passed via options.data */ data?: Record; } export type ComponentRenderFn = (element: ElementNode, ctx: RenderHTMLContext) => string | Promise; /** * Render a Markdown document to HTML. * * @param document - The parsed Markdown document to render * @param options - Optional rendering options with custom components and data * @returns The HTML string * * @example * ```typescript * import { parseMarkdown } from 'comark' * import { renderHtmlFromDocument } from '@comark/html' * * const document = await parseMarkdown('::alert{type="info"}\nHello!\n::') * * const html = await renderHtmlFromDocument(document, { * components: { * alert: async ([tag, attrs, ...children], { render }) => { * return `
${await render(children)}
` * } * } * }) * ``` */ export declare function renderHtmlFromDocument(document: MarkdownDocument | { nodes: MarkdownDocument['nodes']; }, options?: RendererOptions): Promise;