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)?



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.

  • Will Pandoc create proper heading styles? The type that can be used to create table of content? – Ziv Sep 13 '11 at 11:15
  • With RTF, probably not, but you could convert it from an OpenDocument XML / ODT file to Word, which would probably produce the right headings. HTML might also be an option. – slhck Sep 13 '11 at 11:17
  • Just an update, the only method that preserved the headings was using HTML and then opening it in word. Both ODT and RTF didn't preserve the heading. – Ziv Sep 13 '11 at 12:04
  • While you're updating, the switch should be -s -o and need to be used with all three types of output. – Ziv Sep 13 '11 at 12:08
  • Ah, great, thank you! I meant to try it when I got home from work, but that saved me a minute :) – slhck Sep 13 '11 at 12:11

There is the Windows tool, mmd2pdf, which converts MultiMarkdown to PDF

It adds multiple syntax features (tables, footnotes, and citations, to name a few), in addition to the various output formats listed above (Markdown only creates HTML). Additionally, it builds in “smart” typography for various languages (proper left- and right-sided quotes, for example).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.