Converting Markdown to Word (docx) via command line on OSX

I write a lot of technical documentation and since most of it tend to end up on the web somewhere I find it easy to use Markdown. It's also convenient to be able to use the same day to day editor I use to write a lot of my code in (currently VSCode). The problem is that Word is still really big out there and a lot of companies tend to ask for documnentation in either .doc or .docx or at least in .pdf.

I'm have a black belt in screwing up word formatting and making documents look bad. Also since my documentation tends to be sporadic and spread throughout the day I would have to keep Word open all the time.

Enter pandoc

Pandoc is a command line application for converting between different document formats and the end result is suprisingly good. It is available for Windows, OSX, Linux and BSD.

If you need to convert files from one markup format into another, pandoc is your swiss-army knife.

In OSX you can install it with homebrew

$ brew install pandoc

And to convert a file called to document.docx.

$ pandoc -o document.docx -f markdown -t docx
Show Comments