Pro

Export markdown to DOCX

Native .docx export from MD View. No Pandoc, no external tools — a Rust OOXML emitter generates real Word documents that open cleanly in Microsoft Word, LibreOffice Writer, Google Docs, and Apple Pages.

Last updated

DOCX export turns the current document into a real Word .docx file. Press Ctrl+Shift+W, or pick File → Export as Word…, choose a destination, and the file is written.

It’s the right tool when a non-technical reviewer wants to leave comments in Word, when a team’s house style is “everything in .docx,” or when you need to drop markdown into a track-changes review pipeline.

How it works under the hood

No Pandoc, no shelling out to an external tool. MD View ships a native OOXML emitter written in Rust. The frontend walks the markdown-it token stream into a typed AST; the Rust side turns that AST into the XML parts inside a real .docx zip ([Content_Types].xml, _rels/.rels, word/document.xml, word/styles.xml, word/_rels/document.xml.rels, and any word/media/image*.{ext}).

The output uses Word’s built-in style IDs (Heading1Heading6, Quote, HTMLPreformatted, Hyperlink) so it opens cleanly in the four target applications without warnings: Microsoft Word, LibreOffice Writer, Google Docs (upload), and Apple Pages.

What translates natively

  • Headings (H1–H6) → built-in Heading1Heading6 styles
  • Paragraphs → plain <w:p>
  • Bold / italic<w:b/> / <w:i/> runs
  • Inline code → monospace + light gray shading
  • Hyperlinks → real OOXML hyperlinks via relationships, styled with the Hyperlink character style (blue + underline)
  • Code blocks → single paragraph, monospace, line breaks preserved
  • Bullet and numbered lists → visual or 1. prefix + indent (no numbering.xml — keeps the file simple and predictable)
  • Nested lists → recursive, indent grows per depth
  • Tables (GFM) → real <w:tbl> with full borders and a shaded header row
  • Images → embedded as word/media/imageN.{png,jpeg,gif,svg}, sized via the live DOM’s naturalWidth × naturalHeight, scaled down to page text width if needed
  • Blockquotes → built-in Quote style
  • Horizontal rules → paragraph with bottom border
  • Soft line breaks → collapse to a space
  • Hard line breaks<w:br/>

Visible-fallback policy

The exporter never silently drops content. Every Markdown construct either renders natively or emits a visible fallback that preserves the source. The fallbacks v1 ships:

Source featureFallback in DOCX
Mermaid diagramRendered as a normal code block — you get the diagram source, not a rasterized image
Inline math $x$Inline code with the LaTeX source
Block math $$…$$Code block with the LaTeX source
GitHub / Obsidian alertBlockquote with the label as a bold first run
Task list checkboxUnicode (unchecked) or (checked)
Footnote referencePlain text [N] inline
Footnote definitionsSeparator + each definition as a paragraph prefixed [N]

Mermaid as embedded PNG and native Word equation rendering (OMML) are tracked v2 candidates — not in v1, by design, to keep the emitter small and predictable.

What’s not in v1

  • Syntax-highlighted code colors. Code is monospace black on light gray; the highlight.js spans are not translated to <w:color> runs.
  • Native Word equations (OMML). Math is the LaTeX text fallback above.
  • Auto-renumbering numbered lists. Lists use visual prefixes; Word won’t renumber them when you edit.
  • Custom styles, themes, or fonts. Built-in style IDs only.
  • Clickable footnote jump links. Footnote content is preserved; the bookmark relationships that make footnote refs clickable in Word are deferred.
  • Table of contents inside the exported document. The TOC belongs to the reader, not the export.
  • Document properties (title, author, modified date in docProps/core.xml).
  • CLI batch export. Menu invocation only — mdview export docx file.md is not a thing in v1.
  • Reference-doc style templates. No equivalent of Pandoc’s --reference-doc flag; built-in styles only.
  • Round-trip editing fidelity. Output is for reading and sharing, not editing back to Markdown.

Compatibility

Tested as the v1 ship gate against LibreOffice Writer (the primary developer’s editor — every fixture in the test plan must open cleanly there with no “document is corrupt” warnings, no blank pages, all source content visible). Microsoft Word and Google Docs are the secondary targets.

See also