Notes from a Floating Life Thoughts about productivity, digital living, and leading a simpler life

From Markdown to Word Processor

One argument that I keep hearing from people is that they can’t use plain text or Markdown because they need to produce formatted word processor documents — for example, Microsoft Word or LibreOffice Writer. An interesting argument, but not one I buy.

Why? With Markdown, you can generate a word processor document. Well, with a little help from a tool called Pandoc.

Pandoc is a very powerful tool that can convert between various markup languages. It also understands some extensions to Markdown, which makes it quite useful for converting Markdown to a word processor format. Best of all, it’s available for Linux, Mac OS, and Windows.

Now the important news: Pandoc is a command line application with a large number of options. But don’t let that intimidate you. I use Pandoc a lot and only touch a half dozen of those options.

Anyway, for what I’m going demonstrate, you just need to remember one string of commands (or two, if you jump between word processor formats).

Let’s assume you have a Markdown file that you want to convert to a Microsoft Word file. Open a terminal window, navigate to the directory in which the Markdown file resides, and then type:

pandoc -o filename.docx

Where filename is the name of your document.

If you want to create a file for LibreOffice Writer or Writer instead, change the extension .docx to .odt.

One thing you’ll notice is that the resulting document uses styles. And when writing in a word processor (or anything else), you should always use styles. Period.

While you won’t get a complex page layout with this conversion, you can apply a word processor template to the converted file to get the page layout you want.

Thoughts? Let's start a conversation on Twitter.

Did you enjoy this post or find it useful? Then please consider supporting this blog with a micropayment via PayPal. Thanks!