Emacs pandoc-mode

Joost Kremers PhD Institute for German Philology Käte-Hamburger-Weg 3
37073 Göttingen Germany joost dot kremers at phil dot uni-goettingen dot de

pandoc-mode is an Emacs mode for interacting with pandoc. Pandoc is a program (plus libraries) written by John MacFarlane that can convert a text written in one markup language into another markup language. It supports as input formats markdown and (subsets of) reStructuredText, HTML, and LaTeX, and as output formats markdown, reStructuredText, HTML, LaTeX, ConTeXt, PDF, RTF, DocBook XML, OpenDocument XML, OpenOffice.org text document (odt), GNU Texinfo, MediaWiki markup, groff man pages, and S5 HTML slide shows.

pandoc-mode is implemented as a minor mode that can be activated alongside the major mode for any of the supported input formats. It provides facilities to set the various options that pandoc accepts and to run pandoc on the input file. Features include:

Download

The source code is released under a BSD-license and available here:

Version 0.1.6: pandoc-mode.el

NB: This version is written for pandoc v1.2. The latest pandoc version is v1.4, which introduces several new options. To access these options through pandoc-mode, use the development version available at Github.com.

Note that this should be considered alpha software, so bugs are likely. Please report any bugs you may find to .

Also, if you have any suggestions for improvements, I'd appreciate hearing them.

Manual

The manual for pandoc-mode is available as HTML and as PDF.

Know issues

On OS X, if you install pandoc through cabal into your home directory and add ~/.cabal/bin to your path in ~/.profile, ~/.bashrc or some other shell's rc file, it is likely that Emacs won't see this changed PATH variable. If you then run markdown2pdf from within Emacs, you'll get an error in the output buffer:

markdown2pdf: Could not find pandoc

The easiest way to remedy this is to add the following line to your ~/.emacs:

(setenv "PATH" (concat "/Users/<user_name>/.cabal/bin:" (getenv "PATH")))

Change <user_name> to your user name, of course.


Pandoc v1.4 contains a completely rewritten markdown2pdf command (it used to be a shell script, now it is written in Haskell). The old version accepted all options that pandoc itself accepts, but the new version only accepts options that make sense for markdown2pdf. (You can get a list of these by typing markdown2pdf --help at the prompt.) The next release of pandoc-mode will filter out any options that markdown2pdf does not accept, but for now, you will need to make sure they do not appear in your "latex" settings.