UNPKG

@mdast2docx/remark-docx

Version:

A unified plugin to prepare MDAST trees for DOCX conversion using mdast2docx.

28 lines (27 loc) 1.21 kB
import type { OutputType } from "docx"; import type { Root } from "mdast"; import { type IDocxProps, type ISectionProps } from "mdast2docx"; import { emojiPlugin, imagePlugin, listPlugin, mermaidPlugin, tablePlugin } from "mdast2docx/dist/plugins"; import type { Plugin } from "unified"; export interface Mdast2DocxPluginProps { mermaid?: Parameters<typeof mermaidPlugin>[0]; list?: Parameters<typeof listPlugin>[0]; table?: Parameters<typeof tablePlugin>[0]; emoji?: Parameters<typeof emojiPlugin>[0]; image?: Parameters<typeof imagePlugin>[0]; } /** * A unified compiler plugin to convert MDAST to DOCX output using `mdast2docx`. * * @param outputType - The output type for DOCX generation (e.g. "blob", "buffer", "base64"). * Defaults to `"blob"`. * @param docxProps - Global DOCX document properties passed to `toDocx`. Optional. * @param sectionProps - Section-level props including plugin overrides. Optional. * @returns A unified plugin that injects a DOCX compiler. */ export declare const remarkDocx: Plugin<[ outputType?: OutputType, docxProps?: IDocxProps, sectionProps?: ISectionProps, pluginProps?: Mdast2DocxPluginProps ], Root>;