UNPKG

webforai

Version:

A library that provides a web interface for AI

44 lines (43 loc) 1.18 kB
import type { Nodes as Mdast, RootContent } from "mdast"; import { type Options as ToMarkdownOptions } from "mdast-util-to-markdown"; /** * Options for the `mdastToMarkdown` function. */ export interface MdastToMarkdownOptions extends ToMarkdownOptions { /** * The base URL to use for replacing relative links. */ baseUrl?: string; } /** * Default options for the `mdastToMarkdown` function. */ export declare const DEFAULT_MDAST_TO_MARKDOWN_OPTIONS: MdastToMarkdownOptions; /** * Converts an MDAST tree to a Markdown string. * * @param mdast - The MDAST tree to convert. * @param options - Options for the conversion. * @returns The Markdown string. * * @example * ```ts * import { mdastToMarkdown } from './your-library'; * * const mdast = { * type: 'root', * children: [ * { * type: 'paragraph', * children: [ * { type: 'text', value: 'Hello, world!' } * ] * } * ] * }; * * const markdown = mdastToMarkdown(mdast); * console.log(markdown); // Output: "Hello, world!" * ``` */ export declare const mdastToMarkdown: (mdast: Mdast | RootContent[], options?: MdastToMarkdownOptions) => string;