Pandoc Styling
Some styling notes on pandoc.
Quick Access
Markdown to PDF with Docker
Create head.tex
: (reference)
% change background color for inline code in
% markdown files. The following code does not work well for
% long text as the text will exceed the page boundary
\definecolor{bgcolor}{HTML}{E0E0E0}
\let\oldtexttt\texttt
\renewcommand{\texttt}[1]{
\colorbox{bgcolor}{\oldtexttt{\footnotesize{#1}}}
}
Run command:
MARKDOWN_FILENAME="<MARKDOWN_FILENAME>.md"
docker run --rm \
--volume "$(pwd):/data" \
--user $(id -u):$(id -g) \
pandoc/extra "$MARKDOWN_FILENAME" \
--template eisvogel \
-f markdown-blank_before_blockquote \
-V colorlinks=true \
-H head.tex \
-o output.pdf
-f markdown-blank_before_blockquote
removes the additional newline before blockquotes required by pandoc-V colorlinks=true
makes the link text colorful-H head.tex
adds a grey background on inline code blocks.
To reduce the inline code block size:
docker run --rm -it \
--volume "$(pwd):/data" \
--entrypoint=sh \
pandoc/extra
MARKDOWN_FILENAME="<MARKDOWN_FILENAME>.md"
pandoc "$MARKDOWN_FILENAME" \
--template eisvogel \
-f markdown-blank_before_blockquote \
-V colorlinks=true \
-H head.tex \
-o output.pdf \
--pdf-engine=xelatex
Further Notes
I have made some notes in 2018, which can be found here.