Markdown and Pandoc and Libreoffice Oh My! Easily swapping from markdown to libreoffice

As some folks have found out (to their consternation), I routinely use markdown to write … well, just about everything.  It’s pretty simple:

#This is a level one header
##This is a level two header
###This is a level three header

*this is italics*
**this is bold**

* This
* is a
* bulleted list.

As you can see, it’s pretty easy to just “read” without any special formatting.  It’s essentially plain text, so you can use it on any machine that has the most basic of text editors without installing or changing anything else.  And I’ve been using it with my contract templates and policies.

All of which is great – until you want to convert it to something prettier or with more tweaks and fiddly bits (especially if you don’t want to worry about TeX – and if you don’t know, don’t ask).

Enter pandoc, which will handle all of this for us along with a quick shell script and pass it on to LibreOffice.   (And if you’ve not tried LibreOffice lately, it’s matured to the point that I haven’t used Word in months… and yes, that includes track changes and comments.)

Converting from markdown to Libreoffice? Fairly easy – once you figure out what exactly you want it to do. So here’s what I’ve come up with:

pandoc filename.md -V geometry:margin=1in -s -o filename.odt

Or if you’re using something like Doublecommander (or anything that lets you pass a filename) you can use this simple shell script:

Going the other way is a little trickier – I’ll try to post that in the next few days.

2 thoughts on “Markdown and Pandoc and Libreoffice Oh My! Easily swapping from markdown to libreoffice

  1. Thank you for good post!

    It would be interesting to read other way conversion, especially interesting what is related to pre-formatted and code blocks and inline code.

Comments are closed.