I finally switched to Markdown or rather Pandoc for my presentations, writings, and even for my blog.

Editing in vim

There is a nice vim bundle for pandoc users at https://github.com/vim-pandoc/vim-pandoc.

The only thing that has nerved me was that using the predefined :Pandoc… commands did not write the file automatically. But this one was really easy to fix. I am using F5to produce an HTML file and F6 for PDF generation:

au FileType pandoc map  <F5>  :w<CR>:PandocHtml<CR><ESC>
au FileType pandoc imap <F5>  <esc><F5>a
au FileType pandoc map  <F6>  :w<CR>:PandocPdf<CR><ESC>
au FileType pandoc imap <F6>  <esc><F6>a

BTW, my vim configuration can be found at https://github.com/obcode/dotfiles.

Editing elsewhere

A really nice sort of WYSIWYG editor is Mou. Two drawbacks:

  • It’s available only for Max OS X.
  • It is, of course, not aware of any pandoc extension.

But it’s very useful for editing blog posts like this one for http://telegr.am/.

On my Android phone I am using DroidEdit with which it is possible to edit files directly in Dropbox.


Growing up — w.r.t. my computer science life — as a FreeBSD ports committer I am using Makefiles in a lot of places.

My simplest setup for generating HTML and PDF using pandoc is the following Makefile snippet:

%.html: %.txt
    pandoc -s -S -o $(subst .txt,.html,$<) $<

%.pdf: %.txt
    pandoc -S -o --toc $(subst .txt,.pdf,$<) $<

Apologies for using GNU Make instead of BSD Make :-)

-s means “generate a standalone file”, which is the default when generating a PDF
-S means “generate typographically correct output” and stands for smart
-o is used to specify an output file instead of printing to stdout
--toc generates a table of contents. I usually like to have a TOC in my PDFs but not in my plain HTML files

Pandoc is smart enough to recognize the output format from the output file extension. Therefore it is not necessary to specify the format using -t.

BTW, I am using .txt instead of .md or .markdown or … because this way people who are not aware of Markdown, like some of my students, are able to open these files with a simple text editor and are not asked for a special application which can handle Markdown files.

Usually, I add all and clean targets like so:

HTML_FILES= filename1.html filename2.html
PDF_FILES=  filename1.pdf filename2.pdf

all: all_html all_pdf
all_html: $(HTML_FILES)
all_pdf: $(PDF_FILES)

    rm -f $(HTML_FILES) $(PDF_FILES)


As stated before, I am using Pandoc now for all my presentations. Before that I have been using LaTeX with the beamer documentclass. Now I am generating Slidy slideshows by just adding -t slidy to the line generating HTML like so

pandoc -t slidy -s -S -o filename.html filename.txt

If you want to be able to use the resulting presentation offline you can use the --self-contained flag. Furthermore, it is possible to customize almost everything for your own needs by specifying a custom CSS file, a special header file and so forth. I have already thought about it, but currently I am using plain slidy.