
Pandoc: How to Convert Markdown to DOCX
Updated
Learn how to convert a Markdown file into a Word document using Pandoc

Before we start, make sure you have Pandoc installed on your computer, a terminal window open, and your Markdown file ready.
First, use your terminal to navigate to the folder where your file is saved. In this example, we are converting README.md into document.docx. Type pandoc README.md -o document.docx and press enter. The -o flag tells Pandoc what to name the output file.
For a typical document, the conversion happens almost instantly, though larger files can take a couple of seconds. Don't worry if you don't see a success message—when Pandoc is finished, your terminal will simply return to a blank prompt.
To make sure everything worked, run ls or look in your folder to see your new document.docx file, then open it to check your formatting.
If you want your exported file to use custom fonts or margins, you can pass a styled Word file as a template using the --reference-doc option.
