Markdown to Word
Native, Modular, Extensible
Convert Markdown into native, editable Word (.docx) documents in browsers or Node.js. Modular by design — cherry-pick official plugins, or easily author your own.
Pluggable Architecture & Official Plugin Ecosystem
Select your compilation target, toggle our rich suite of official plugins, or wire custom AST transformers to export native Microsoft Word (.docx) documents in real-time.
md2docx Feature Showcase
A balanced, complete demonstration of standard Markdown, GitHub Flavored Markdown (GFM), math formulas, diagrams, tables, and rich HTML tags converted into a native Microsoft Word (.docx) document.
1. Mathematical Formulas (@m2d/math)
Inline equation: Einstein's mass-energy equivalence is . Pythagorean theorem: .
Display integral equation:
Euler's identity:
Quadratic formula:
2. Mermaid Diagram (@m2d/mermaid + @m2d/image)
3. Data Tables (@m2d/table)
| Plugin Package | Category | Execution Target | Status |
|---|---|---|---|
@m2d/core | Engine | Universal (Browser + Node) | Stable |
@m2d/math | Plugin | Word MathRuns / Equations | Active |
@m2d/mermaid | Plugin | SVG to Raster Embedding | Active |
@m2d/table | Plugin | OpenXML Tables & Alignments | Active |
@m2d/list | Plugin | Numbered & Bulleted Hierarchies | Active |
@m2d/html | Plugin | Raw HTML to DOCX Elements | Active |
@m2d/image | Plugin | Browser Image / Canvas Rasterizer | Active |
@m2d/image-node | Plugin | Node.js / Sharp Image Rasterizer | Active |
4. Nested Hierarchical Lists (@m2d/list)
- Engine Architecture
- Core AST parsing
- Section configuration
- Plugin Ecosystem
- Graphic Renderers
- Mermaid Diagrams
- Math LaTeX
- Typography
- Rich HTML styling
- Custom bullet sets
- Graphic Renderers
5. Inline HTML & Styling (@m2d/html)
Press <kbd>Ctrl</kbd> + <kbd>P</kbd> to export or inspect. Status: <span style="color: #16a34a; font-weight: bold;">● Live & Ready</span> Important note: <mark style="background-color: #fef08a;">Highlighted text rendered directly in Word</mark>.
6. Embedded Graphics (@m2d/image)
Why Developers & Enterprises Choose Md2Docx
A purpose-built document compiler that balances lightweight frontend privacy with robust server-side automation.
Universal Dual Execution
Compile 100% in the browser with WebAssembly & JS for zero latency and complete data privacy, or stream headlessly in Node.js backends and serverless workers.
Native OpenXML Fidelity
Translates Markdown AST nodes into genuine Microsoft Word structures — native MathML equations, editable tables, vector graphics, and true outline numbering.
Pluggable Core & Rich Official Plugins
Engineered on the Unified & Remark AST ecosystem. Leverage our comprehensive suite of official plugins or write custom plugins.
Executive Cover Pages & Callouts
Turn YAML/TOML frontmatter into professional title pages, divider rules, author metadata lines, page breaks, and callout banners with zero manual markup.
Zero-Config Terminal CLI
Run instant document compilation via npx @m2d/cli or in CI/CD release pipelines with structured logging, configuration files, and multiple binary aliases.
Generative AI Document Bridge
Transform raw Markdown output from ChatGPT, Claude, and Gemini into corporate-ready Word deliverables with robust self-healing and error resiliency.
How Md2Docx Compares
See how Md2Docx stacks up against traditional CLI binaries, imperative libraries, and HTML wrappers.
| Feature / Capability | Md2Docx | Pandoc | docx.js alone | html-docx-js |
|---|---|---|---|---|
| Runs 100% in Browser | Yes (0ms network, full privacy) | No (native binary required) | Yes (client-side only) | Yes (limited DOM) |
| Markdown / MDAST First | Native AST parsing & transforms | Yes (internal AST) | Manual imperative code only | HTML parsing only |
| Zero Binary Dependencies | Pure TypeScript / JavaScript | Requires Haskell/C++ binary | Pure JavaScript | Pure JavaScript |
| LaTeX Equations to OMML | Native Word Math elements | Requires LaTeX engine | Manual MathRuns required | Not supported |
| Mermaid to Embedded Vector | Automatic SVG + self-healing | Requires external filter / CLI | Manual image buffers | Not supported |
| Extensible Plugin Pipeline | Standard Unified / Remark plugins | Lua filters | Imperative function wrappers | None |
| Serverless & Edge Ready | Lightweight (~35-40kB core) | Heavy container footprint | Lightweight | Limited support |
The Md2Docx Modular Ecosystem
Organized into clear architectural layers — start with high-level batteries-included entry points, or cherry-pick lightweight scoped plugins for microservices and edge runtimes.
@m2d/md2docx
All-in-one batteries-included Markdown to DOCX converter with zero configuration.
@m2d/cli
Zero-config terminal CLI and headless batch document generation engine.
mdast2docx
Complete all-in-one distribution bundle pre-wired with all official plugins.
@m2d/tiptap
Client-side DOCX export extension for Tiptap 3 / ProseMirror with frontmatter preservation.
@m2d/react-markdown
SSR-friendly React Markdown renderer that captures AST for instant Word export.
@m2d/remark-docx
Official Unified/Remark compiler plugin for direct in-browser DOCX generation.
@m2d/remark-docx-node
Server-side Remark compiler plugin with native Sharp and beautiful-mermaid rasterization.
@m2d/frontmatter
Parses YAML/TOML front-matter metadata into docxProps, cover pages, and info-boxes.
@m2d/table
Rich GFM tables with custom borders, cell padding, repeating headers, and background shading.
@m2d/math
LaTeX math equations translated directly into native editable Word OMML MathML.
@m2d/mermaid
Browser Mermaid diagrams with SVG extraction and self-healing syntax error repair.
@m2d/mermaid-node
Headless server-side Mermaid renderer powered by beautiful-mermaid with zero browser dependencies.
@m2d/html
Converts HTML tags, inline CSS styles, and <style> block stylesheets into styled OpenXML nodes.
@m2d/html-node
Lightweight server-side HTML parser powered by LinkeDOM without heavy JSDOM overhead.
@m2d/image
Browser image rasterization with IndexedDB caching and collapsible code block fallbacks.
@m2d/image-node
Server-side image rasterizer powered by Sharp with authentic Word code block fallbacks.
@m2d/list
Hierarchical decimal numbering (1.1.1) and custom nested bullet glyphs.
@m2d/core
Foundational AST-to-OpenXML compiler, plugin pipeline, and warnings deduplication.
@m2d/cache
Persistent xxhash-wasm and IndexedDB caching engine for rasterized diagrams and assets.
@m2d/mdast
TypeScript types and schemas for extended MDAST OpenXML nodes and properties.