A simple docker image for pandoc with filters, templates, fonts and additional tools.
Run dalibo/pandocker
with regular pandoc
args. Mount your files at /pandoc
.
$ docker run --rm -u `id -u`:`id -g` -v `pwd`:/pandoc dalibo/pandocker README.md -o README.pdf
Notes about the docker options:
-v ...
option will mount the current folder as the /pandoc
directoryinside the container. If SELinux is enabled on your system, you might need toadd the --privileged
tag to force access to the mouting points. For moredetails, read the documentation about docker runtime privileges.The --rm
option destroys the container once the document is produced.This is not mandatory but it's a good practice.
The -u
option ensures that the output files will belong to you.Again this is not necessary but it's useful.
Tip: You can define a shell alias to use
pandocker
just likepandoc
.Add this to your~/.bashrc
:
$ alias pandoc="docker run --rm -u `id -u`:`id -g` -v `pwd`:/pandoc dalibo/pandocker"
$ pandoc README.md -o README.epub
Alternatively, you can use a pipe like this:
$ cat foo.md | docker run --rm -i dalibo/pandocker -t pdf > foo.pdf
This method will not work if the source document contains images or includes...
We're shipping a selection of latex templates inside the image so that youcan produce nice PDF documents without installing anything.
So far, we provide the 3 templates below:
pdflatex
and xelatex
.xelatex
xelatex
You can use them simply by adding --template=xxx
to your compilationlines:
$ docker run [...] --pdf-engine=xelatex --template=eisvogel foo.md -o foo.pdf
Each template has specific variables that you can use to adapt the document.Please go the project page of each template for more details.
This docker image embeds a number of usefull pandoc filters. You can simply enable themby adding the option --filter xxx
where xxx
is the name of one of the followingfilters below:
NOTE: By default when using the pandoc-include filter, the path to targetfiles is relative to the /pandoc
mountpoint. For instance,the !include [foo/bar.md]
statement will look for a /pandoc/foo/bar.md
file.You can use the docker arg --workdir="some/place/elsewhere"
to specifyanother location. The same principle applies to the pandoc-codeblock-includeand pandoc-mustache filters.
The pandocker image includes the following open-source fonts:
The full variant includes
The image is available in multiple versions named as follows:
branch[-parent[-variant]]
latest
(default) or stable
(for production)or the release name (20.02
)buster
(default)or alpine
extra
(330MB) or full
(810 MB)The supported tags are :
latest
, latest-buster
, latest-buster-extra
(default)latest-buster-full
stable
, stable-buster
, stable-buster-extra
stable-buster-full
Other tags are not supported and should be used with care.
Use make
or docker build .
The docker image embeds additional software related to editing and publishing:
These tools can be called by modifying the entrypoint of the image. For instance,you can convert a dia
source file into an SVG image like this:
$ docker run [..] --entrypoint dia dalibo/pandocker foo.dia -e foo.svg