Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🐳 A simple docker image for pandoc with filters, templates, fonts, and the latex bazaar

License

NotificationsYou must be signed in to change notification settings

dalibo/pandocker

Repository files navigation

github releaseDocker ImageCILast Commit

A simple docker image for pandoc withfilters,templates,fonts andadditional tools.

Install / Upgrade

Download the image with:

docker pull dalibo/pandocker:stable

Whenever a new stable version is released, launch that command again to refreshyour image.

How To

Rundalibo/pandocker with regularpandoc 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:

  • The-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 aboutdocker 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 usepandocker just likepandoc.Add this to your~/.bashrc :

alias pandoc="docker run --rm -u `id -u`:`id -g` -v `pwd`:/pandoc dalibo/pandocker:stable"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...

Templates

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:

  • eisvogel is designed for lecture notes and exercises with a focus on computerscience. It works withpdflatex andxelatex.
  • easy templates is a collection of HTML templates

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.

Filters

This docker image embeds a number of usefull pandoc filters. You can simplyenable them by adding the option--filter xxx wherexxx is the name ofone of the following filters below:

NOTE: By default when using thepandoc-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 thepandoc-codeblock-includeandpandoc-mustache filters.

Fonts

The pandocker image includes the following open-source fonts:

The full variant includes

Supported Tags : Branch + Variant + Parent

The image is available in 4 versions named as follows:

  • latest (default): minimal image containing the most recent changes
  • stable : minimal image based on the latest stable release
  • latest-full (default): complete image containing the most recent changes
  • stable-full : complete image based on the latest stable release

You can also the release names for instance

docker pull dalibo/pandocker:24.05

the previous versions add more complex tags such aslatest-ubuntu-extraorstable-buster. They are not supported anymore.

Build it

Usemake ordocker build .

Additional tools

The docker image embeds additional software related to editing and publishing:

  • dia a simple tool to design diagrams
  • poppler-utils a collection of tools built to manage PDF and extract content
  • rsync for deployment

These tools can be called by modifying the entrypoint of the image. For instance,you can convert adia source file into an SVG image like this:

docker run [..] --entrypoint dia dalibo/pandocker foo.dia -e foo.svg

Frequently Asked Question

ERROR: "filename": openBinaryFile: does not exist (No such file or directory)

When using pandocker, you may encounter the following error message:

$ docker run --rm -u `id -u`:`id -g` -v `pwd`:/pandoc dalibo/pandocker foo.mdpandoc: "filename": openBinaryFile: does not exist (No such file or directory)

This means that docker could not mount the local directory as a volume andtherefore pandoc cannot see the filefoo.md inside the container. There mightbe several reasons for that, here a few ideas to try:

  1. Add--privileged option to the pandocker command line. Read more aboutthisdocker privileged mode here :https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities

  2. Check if you haveSELinux enforced on you system, with the command below:

sestatus

If theSELinux mode isenforced, you can try to lower it topermissive.

More info aboutSELinux here:https://fedoraproject.org/wiki/SELinux_FAQ


[8]ページ先頭

©2009-2025 Movatter.jp