Home pandoc md file to pdf
Post
Cancel

pandoc md file to pdf

On linux to install pandoc:

1
2
3
4
5
6
7
$ sudo apt install \
    pandoc \
    texlive-latex-base \
    texlive-fonts-recommended \
    texlive-extra-utils \
    texlive-latex-extra \
    texlive-xetex

Then if you want to convert a markdown file to pdf you run:

1
$ pandoc file-name.md -o file-name.pdf --pdf-engine=xelatex

To change the colour scheme for the code chunks, add the --highlight-style=<style name> option. A list of them are shown here

For example you could run:

1
$ pandoc --highlight-style=breezedark file-name.md -o file-name.pdf --pdf-engine=xelatex

To add a table of contents add the --toc option.

This post is licensed under CC BY 4.0 by the author.