mdast2docx logo Md2Docx
Version 0.1.1API DocsFunctions

md2docx()

Updated 22 Oct 2026

md2docx<T>(md, docxProps?, sectionProps?, outputType?, pluginProps?): Promise<OutputByType[T]>

Defined in: packages/cli/src/shared.ts:26

Converts Markdown to DOCX in Node.js using @m2d/remark-docx-node with native image and Mermaid rasterization.

Type Parameters

T

T extends keyof OutputByType = "nodebuffer"

Parameters

md

string

Markdown string input

docxProps?

IDocxProps = {}

Global document properties passed to @m2d/core

sectionProps?

Optional<IDefaultMdastToDocxSectionProps>

Default section properties (page size, margins, plugins)

outputType?

T = ...

Desired DOCX output format ("nodebuffer" by default on Node)

pluginProps?

Mdast2DocxNodePluginProps

Configurations for sub-plugins (nodeImage, nodeMermaid, list, table, emoji)

Returns

Promise<OutputByType[T]>

The generated DOCX output

On this page