Pandoc

Created: by Pradeep Gowda Updated: Mar 18, 2024 Tagged: markdown · pandoc

Pandoc is a program that converts between various text markup formats.

Pandoc allows you to customise the output via extensive command line arguments and by templates.

  • Semantic CSS for Pandoc – an attempt at finding and using various semantic Cascading Style Sheets with Pandoc’d default HTML rendering.

Guides on using Pandoc to write books

Editors

Customising pandoc

These are some of the examples of users customising pandoc to output LaTeX, HTML to their taste and requirements.

My own attempts are here:

Book templates

Filters

Pandoc filters can be written in Haskell which modify the document structure programmatically. These are some of the user written filters that are instructive:

Exporters

Ox-pandoc is an exporter that translates Org-mode file to various other formats via Pandoc.

Markdown to InDesign; Pandoc now ships with a writer able to produce an ICML file from any Pandoc-supported input file format.13 ICML is the document format of Adobe InCopy; Dec 2015.

Books written using pandoc

See also

Styling

Sites built using Pandoc

Book publishing

Using with weasyprint

From an HN thread:

It’s even possible to replace (Xe)LaTeX with weasy, a Python HTML-to-PDF converter. It supports two-colums via CSS, automatic CSS hypens, CSS page counters and embedding SVGs. I just needed an HTML header with CSS in the markdown file.

$ pandoc --filter pandoc-citeproc --csl ieee.csl --bibliography=paper.bib --smart --normalize -f markdown+multiline_tables+inline_notes -t html5 -V margin-top:0.5in -V margin-bottom:0.5in -V margin-left:0.5in -V margin-right:0.5in -o output.html input.md
$ python3 -c "from weasyprint import HTML; HTML('output.html').write_pdf('output.pdf', presentational_hints=True)"

For LaTeX-style math equations I added mathjax-pandoc-filter as filter to the pandoc args:

--filter ~/node_modules/.bin/mathjax-pandoc-filter -Mmathjax.centerDisplayMath -Mmathjax.noInlineSVG