I have automated my build to convert Markdown files to DOCX files using Pandoc. I have even used a reference document for the final document\'s styling. The command I use is
Ideally you could use a custom docx template, but pandoc doesn't support that yet. A reference.docx
file only allows custom styles to be embedded in newly created docx files.
Fortunately you can approximate this using odt instead of docx. You can fairly easily modify the default OpenDocument template to include your custom logos, preamble, and other stuff. Use the custom template in conjunction with a reference.odt
file to get all the styles and custom content.
Once you have the file in odt format, you can use any number of command line tools to convert from odt to docx. For example, on Linux you can run
libreoffice --invisible --convert-to docx test.odt
Or on OS X:
/Applications/LibreOffice.app/Contents/MacOS/soffice.bin --invisible --convert-to docx test.odt