Markdown
Convert DOCX to Markdown with layout-derived pages in one function call.
Convert DOCX to Markdown in one call. Get the full document and individual pages, including separate headers, footers, comments, and tracked changes.
Try the demo · Integrations · API reference
npm install @docx-editor.dev/docx-to-markdownimport { readFile } from 'node:fs/promises';
import { exportMarkdown } from '@docx-editor.dev/docx-to-markdown';
const docxBytes = await readFile('document.docx');
const result = await exportMarkdown(docxBytes);
console.log(result.markdown);Keep the page numbers
The document layout engine calculates page breaks.
for (const page of result.pages) {
console.log(page.number, page.markdown);
console.log(page.headerMarkdown, page.footerMarkdown);
}result.markdown joins the body into one document. Headers and footers stay in result.pages.
For search and AI ingestion, use { displayMode: 'proposed' } to show pending insertions and hide pending deletions. The default, 'all-markup', shows both.
Runtime and output
Runs in Node.js with bundled fonts and WebAssembly. Next.js uses the Node.js runtime and server package configuration. Edge runtimes are not supported.
Page breaks depend on fonts, document features, and revision mode; they can differ from Microsoft Word. Store the document version with page citations. result.warnings reports omitted images, shapes, text boxes, and font problems. See output limits before using the output as a complete transcription.
Apache-2.0, including comment and tracked-change extraction. Bundled fonts retain their own open-source licenses.
Dark mode
Enable dark mode in the DOCX editor with the colorMode prop: theme the chrome, render the document canvas like Word dark view, and toggle from your own UI.
@docx-editor.dev/pro
Add tracked changes and comments to Vue or React. Register the review module, then use the packaged rail or review composables.