Pandoc 2.0

new features in my favourite typesetting program

Created: by Pradeep Gowda Updated: May 22, 2020 Tagged: pandoc

Pandoc 2.0 was released recently. Some of the things I was waiting for:

Using toc as a metadata key-value pair to set if the Table of Contents should be shown on the rendered page. Before 2.0 I used to get around this by using my own metadata variable called toca (very creative! huh?) and then modifyig the template to use this toca variable as a boolean to show the table of content block (or not). Now Pandoc has added native support for this behaviour.

New output format – ms (groff ms). This is great because ms macros produce documents that are compact to print and IMO waste very little space unlike the default TeX documents which have generous margins.

This is how to convert a markdown to printable PostScript file:

pandoc document.md -t ms -o document.groff
groff -ms document.groff > document.ps

where, -ms is the macro package.

While the .ps file is sufficient to print, you may optionally want to convert it into PDF, espcially if you are sharing with people who may not have a native PS reader installed on their system.

On a mac:

ps2pdf14 document.ps

This will create document.pdf.

NOTE: Apparently one does not have to go through all these complicated steps to generate a PDF via the troff pipeline! Just use pandoc -t ms -o output.pdf input.txt.

Writing filters is now much more easier thanks to the new Lua Filter built right into Pandoc starting this version!. This is come in really handy if you want to write custom syntax extensions (eg: Using pandoc-include-code to insert specific lines from a source file as a pre-processing step)

There are lot more changes that I’m still trying to get through. This is a big release!