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


My OS is OSX so the easiest is to use Homebrew.

With homebrew

$ brew install pandoc

Use the installer

Go to the github project downloads


Convert your document

$ pandoc -o output.docx -f markdown -t docx markdown-file.md

Make it easy

To make it even easier I added the below code to my .bashrc file


# aliases
alias md2word=md2word # alias the function below

# functions
function md2word () {  
    PANDOC_INSTALLED=$(pandoc --version >> /dev/null; echo $?)

    if [ "0" == ${PANDOC_INSTALLED} ]; then
        pandoc -o $2 -f markdown -t docx $1
        echo "Pandoc is not installed. Unable to convert document."

Convert a file

 md2word ~/path/to/some/markdown/file/to/convert.md ~/path/to/some/word/document/output.docx

Use Pandoc from Sublime


My customized build file

    "cmd": ["/usr/local/bin/pandoc", "-S", "-s", "-f", "markdown", "-t", "docx", "-o", "/Users/peter/Documents/Docs/Inbox/$file_base_name.docx", "$file_name"],
    "selector": "text.html.markdown"