DEV Community


`pandoc -t context -o out.pdf` doesn't have syntax highlighting

patarapolw profile image Pacharapol Withayasakpunt ・1 min read

If I did it without -t, or with -t latex, it will support highlighting.

Currently highlighting is supported only for HTML, EPUB, Docx, Ms, and LaTeX/PDF output.

Is there a way around this?

Otherwise, can I convert all <pre><code> blocks to HTML blocks, highlight them with Prism.js, and convert back to PNG?

I found this, but couldn't make sense of it.

Why ConTeXt? It seems to be the only way I can,

  • Change paper size mid-way
  • Easier to centering vertically


Editor guide
levirs565 profile image
Levi Rizki Saputra

try converting into HTML. Then convert the HTML to PDF using Chrome or Firefox.

patarapolw profile image
Pacharapol Withayasakpunt Author

I tried to avoid that, because I can't have multiple paper sizes / margins / header-footer control.

zoedreams profile image

try rastering into SVG, draw what you need, then encode back into pdf. annoying i know.