Word – An alternative to Markdown or LaTeX to create Word documents with headings

markdownmicrosoft wordvim

At work I got assigned to do some translation work. I prefer working in vim rather than Word and style it later.

Is there any way to use Markdown style syntax to create Word compatible styling, including retaining headings (to be used for a Table of Contents)?

Best Answer


You can write your Markdown text as usual, then use Pandoc to create an RTF file, which can easily be opened and edited in Word.

Pandoc can read markdown and (subsets of) reStructuredText, textile, HTML, and LaTeX, and it can write plain text, markdown, reStructuredText, HTML, LaTeX, ConTeXt, PDF, RTF, DocBook XML, OpenDocument XML, ODT, GNU Texinfo, MediaWiki markup, textile, groff man pages, …

Pandoc is free, open source and comes for Windows, OS X, Linux and BSD. Check the user's guide here.

For example, use:

pandoc -s -o file.html file.txt
pandoc -s -o file.rtf file.txt
pandoc -s -o file.odt file.txt

… then open it in Word and style as you want. The -s option needs to be used to produce a standalone file. HTML should retain the syntactical "heading" elements, whereas RTF and ODT only style headings.

Related Question