@m2d/core
Version:
Core engine to convert extended MDAST to DOCX. Supports plugins for footnotes, images, lists, tables, and more. Designed for seamless Markdown-to-DOCX conversion.
27 lines (26 loc) • 998 B
TypeScript
import type { Root } from "@m2d/mdast";
import type { Definitions, FootnoteDefinitions, ISectionProps } from "./utils";
import { Paragraph } from "docx";
import * as docx from "docx";
/**
* Converts an MDAST tree to a DOCX document section.
* @param node - The root MDAST node
* @param definitions - Definitions mapping
* @param footnoteDefinitions - Footnote definitions mapping
* @param props - Section properties (optional)
* @returns A DOCX section representation
*/
export declare const toSection: (node: Root, definitions: Definitions, footnoteDefinitions: FootnoteDefinitions, props?: ISectionProps) => Promise<{
children: (Paragraph | docx.Table)[];
headers?: {
readonly default?: docx.Header;
readonly first?: docx.Header;
readonly even?: docx.Header;
};
footers?: {
readonly default?: docx.Footer;
readonly first?: docx.Footer;
readonly even?: docx.Footer;
};
properties?: docx.ISectionPropertiesOptions;
}>;