MDZip for Pandoc lets you...
- Turn an MDZip (
.mdz) file into Word, a web page, an e-book (EPUB), PDF or any other format Pandoc writes, with its pictures included - Combine a document split over several files into one Word file, with the links between them still working
- Turn a Word file or a Markdown file and its pictures into an
.mdz
It's a free add-on for Pandoc, the document converter many writers and publishers already use. Pandoc does the converting; mdzip-pandoc teaches it to read and write .mdz. Everything runs on your own computer.
Install
- Install Pandoc, version 3 or later, if you don't have it yet. It runs on Windows, macOS and Linux.
- Download
mdzip-pandoc-<version>.zipfrom the latest release and unzip it somewhere you'll find it again.
That's all. The folder holds mdz.lua, the file you give Pandoc, and everything it needs. Keep the files in it together.
Convert an .mdz
Open a terminal in the folder with your file, and give Pandoc the path of mdz.lua with -f ("from"). The name of the output file picks the format:
pandoc -f mdzip-pandoc/mdz.lua guide.mdz -o guide.docx
pandoc -f mdzip-pandoc/mdz.lua guide.mdz -o guide.epub
pandoc -f mdzip-pandoc/mdz.lua guide.mdz -s --embed-resources -o guide.htmlThe pictures come from inside the .mdz, so they end up in the Word file, the e-book or the web page. The title, author and language come from the file too. PDF needs a PDF program Pandoc can use, such as a LaTeX installation; see Pandoc's manual.
Several files as one Word document
An .mdz can hold a document split over several files, such as a main page that links to one file per chapter. Add +combine to make them one document:
pandoc -f mdzip-pandoc/mdz.lua+combine+pagebreaks guide.mdz -o guide.docx- The chapters come in the order the main page links to them.
- Links between them become links inside the Word file, so a link to "Installing on Windows" in another chapter still goes there.
+pagebreaksstarts each chapter on a new page. Leave it out to run them together.- Files nothing links to are left out, and Pandoc says which. Add
+orphansto put them at the end.
Without +combine, only the main page is converted, and Pandoc says how many files it left out.
Word styles that travel with the file

Pandoc takes Word's look (fonts, headings, tables, page size and margins, headers and footers) from a reference document: any Word file or Word template (.dotx) whose styles you've set up the way you want. An .mdz can carry its own, so everyone who converts it gets the same look.
Make the reference document. Start from Pandoc's,
pandoc -o reference.docx --print-default-data-file reference.docx, open it in Word and change its styles, or use a template you already have.Add it to the
.mdz, for example asstyles/reference.docx, and name it in the file'smanifest.json:"pandoc": { "referenceDoc": "styles/reference.docx" }Convert with
-t mdzip-pandoc/docx.lua("to"), the Word writer that uses it:pandoc -f mdzip-pandoc/mdz.lua guide.mdz -t mdzip-pandoc/docx.lua -o guide.docx
Only the styles and page setup are used, never the reference document's text or macros. A --reference-doc you give on the command line still wins. Other MDZip apps keep the setting and the file when they save the .mdz.
The grid-tables example carries the reference document in the picture above.
Make an .mdz
Give Pandoc the path of mdz.lua with -t ("to") instead, and name the output .mdz:
pandoc report.docx -t mdzip-pandoc/mdz.lua -o report.mdz
pandoc notes.md -t mdzip-pandoc/mdz.lua -o notes.mdzThe pictures go inside the .mdz: the ones in the Word file, and the ones a Markdown file points to on your computer. Pictures on the web stay links. The result opens in MDZip Studio, the VS Code and Obsidian plugins and the web editor, and passes mdz validate.
On GitHub
mdzip-pandoc is also a GitHub Action, for turning .mdz files into web pages or Word files whenever you push. It can build a whole website from a folder of .mdz pages, with a sitemap and link previews: mdzip-pages-example is one, published on GitHub Pages. See the Action's settings.
Good to know
- It needs Pandoc 3 or later. It's tested with Pandoc 3.13 on Windows, macOS and Linux.
- It reads Markdown the way MDZip editors show it (CommonMark, with Pandoc's extras such as footnotes and math). For Pandoc's own Markdown, with citations and captioned figures, add
+pandoc:-f mdzip-pandoc/mdz.lua+pandoc. - Raw HTML passes through. HTML inside the document reaches HTML output unchanged, as with Pandoc's own readers. For an
.mdzfrom someone you don't trust, add-raw_html(-f mdzip-pandoc/mdz.lua-raw_html): it drops raw HTML, event handlers such asonclick, andjavascript:links. - A file with separate documents (a "project"
.mdz, like a folder of notes) is converted one document at a time: Pandoc converts the main one and says how many it left out. - Some things need extra programs. SVG pictures in Word need
rsvg-convert, and Mermaid diagrams stay as code unless you add a Mermaid filter to Pandoc. - A damaged
.mdzstops Pandoc with an MDZip error code, such asERR_ZIP_INVALID, instead of a half-converted file.
More
- Releases, source and issues on GitHub
- The full reference: every switch, and what's read from and written to the
.mdz - Test script: try it step by step and tell us how it went
- How it's built: Pandoc custom reader and writer scripts on
mdzip-core-lua, the pure Lua MDZip library - Other MDZip tools
This page renders from pandoc.mdz (MDZip, ~30 KB, updated 2026-11-17) — one self-contained file. Download it, open it in the web editor, or read how these pages are made. Built with @mdzip/renderer.