Pandoc Syntax Highlighting Examples

pandoc
Writing
Color
Themes
Published

July 6, 2018

The R Markdown book lists many syntax highlighting color schemes:

highlight specifies the syntax highlighting style. Supported styles include default, tango, pygments, kate, monochrome, espresso, zenburn, haddock, and textmate. Pass null to prevent syntax highlighting.

Which is the same as running pandoc --list-highlight-styles (see Syntax Highlighting in the pandoc manual).1

But I couldn’t find a gallery for choosing among these syntax styles, so here’s a quick comparison.

highlight: default

highlight: default

highlight: espresso

highlight: espresso

highlight: haddock

highlight: haddock

highlight: kate

highlight: kate

highlight: monochrome

highlight: monochrome

highlight: pygments

highlight: pygments

highlight: tango

highlight: tango

highlight: zenburn

highlight: zenburn

––highlight=breezedark

––highlight=breezedark

Update: rmarkdown::pdf_document() doesn’t currently accept breezedark as a highlight style, but you can use the pandoc_args parameter to request this style (added in pandoc 1.19.2):

---
output:
  pdf_document:
    pandoc_args: "--highlight=breezedark"
---

Footnotes

  1. Note that at the time of this writing 2023-02-05, pandoc has a new highlighting style breezedark that rmarkdown::pdf_document rejects. Also, textmate seems to have been deprecated because it is an HTML higlight style, so it is also rejected by pdf_document.↩︎