Pandoc is a universal document converter released under GPL open source license and developed by John MacFarlane.

It can translate documents in different formats from Markdown to word or HTML or ePub and many more.

See website

Pandoc is a Haskell library for converting from one markup format to another From man pandoc

By default, pandoc produces a document fragment. To produce a standalone document (e.g. a valid HTML file including <head> and <body>), use the -s or --standalone flag.

Pandoc supports using a something called a reference document when converting to and from Word files.

You can make pandoc output a dummy Word file, which you can style, and then read in as the reference when converting from for instance Markdown to Word.

This could be helpful in Working with manuscripts and authors – hypermanuscripts