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.
Guides on using Pandoc to write books
- This guide on how to setup pandoc to write fiction by Eugene Kiss is a very good introduction to using pandoc to produce print-ready material.
- words by Steve Klabnik.
These are some of the examples of users customising pandoc to output
HTML to their taste and requirements.
- pandoc academic publication
- IEEE Pandoc template by cscorley – is what i used for writing a IEEE style paper.
- Typesetting automation · A plain-text workflow for painless production of personal documents & offline correspondence—featuring Pandoc, LaTeX, and a simple makefile
- msprev/panzer: pandoc + styles
- Heer de Beer.org—Pandocomatic “… is a tool to re-use these common configurations by specifying a so-called pandocomatic template in a YAML configuration file.”
My own attempts are here:
Pandoc filters can be written in Haskell which modify the document structure programmatically. These are some of the user written filters that are instructive:
- pandoc-emphasize-code – “A Pandoc filter for emphasizing code in fenced blocks.”
- pandoc-reference-filter – This pandoc filter implements an internal reference manager for pandoc, making it possible to reference images and sections that have attribute tags.
- Aditya Mahajan shows how to use gpp preprocessor to include source code files
- baig/pandoc-csv2table: A Pandoc filter that renders CSV as Pandoc Markdown Tables.
- Panflute: pandoc filters made simple — panflute 1.9.7 documentation
- CSV Tables in Markdown — Pandoc Filter for CSV Tables
- PP - A generic Preprocessor (with Pandoc in mind)
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
- The little Redis book
- My own attempts at converting Chuck Moore’s Programming a Problem-oriented language into a “book” using pandoc and some elbow grease. The result is available on github - https://github.com/btbytes/pol
- littleosbook – “The little book about OS development”. Outputs HTML and PDF.
- Customizing pandoc to generate beautiful pdfs from markdown | learnbyexample
- Laika – Text Markup Transformer for sbt and Scala applications, transforming Markdown and reStructuredText to HTML and PDF
- lise-henry/crowbook – converts books written in Markdown to HTML, LaTeX/PDF and EPUB.
- Gotenberg · A Docker-powered stateless API for converting HTML, Markdown and Office documents to PDF.
- jez/pandoc-sidenote: Convert Pandoc Markdown-style footnotes into sidenotes
- panam stylesheet for pandoc
Sites built using Pandoc
- The Tools I Use To Write Books - Thorsten Ball
- Writing a Book with Pandoc, Make, and Vim — Vladimir Keleshev
- Technical Writing with Pandoc and Panflute
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