Skip to Content
Md2Docx logo Md2Docx

toDocx()

Updated 9 Nov 2026

toDocx(astInputs, docxProps?, defaultSectionProps?, outputType?): Promise<string | readonly number[] | ArrayBuffer | Uint8Array<ArrayBufferLike> | Blob | Buffer<ArrayBufferLike>>

Defined in: packages/core/src/index.ts:29

Converts an MDAST (Markdown Abstract Syntax Tree) into a DOCX document.

Parameters

astInputs

IInputMDAST

Single Root MDAST tree (passing an array of multiple ASTs is deprecated and will be removed in the next major version).

docxProps?

IDocxProps = {}

General document properties.

defaultSectionProps?

ISectionProps = DEFAULT_SECTION_PROPS

Default properties for each document section.

outputType?

keyof OutputByType = "blob"

The desired output format (default: "blob").

Returns

Promise<string | readonly number[] | ArrayBuffer | Uint8Array<ArrayBufferLike> | Blob | Buffer<ArrayBufferLike>>

A DOCX document in the specified format.

See

On this page