Pandoc Import / Export
Overleaf can convert documents to and from LaTeX using Pandoc. The conversion runs inside a sandboxed Docker container managed by the clsi service, so the feature is off by default and has to be switched on with a couple of environment variables.
What it does
Environment variables
There are two variables that matter, and one look-alike that does not.
1. ENABLE_PANDOC_CONVERSIONS — the master switch
- Type: boolean (
true enables it; anything else disables it).
- Must be set on BOTH the
web and clsi services. They are separate processes with separate configuration:
web reads it into enablePandocConversions (services/web/config/settings.defaults.js). It gates the import routes, the export routes, and the ol-ExposedSettings.enablePandocConversions flag that tells the frontend whether to show the Import/Export UI.
clsi reads it into enablePandocConversions (services/clsi/config/settings.defaults.cjs). It gates the endpoints that run Pandoc.
- If it is enabled on
web but not on clsi (or vice-versa), the UI will appear but the conversion will fail — keep them in sync.
2. PANDOC_IMAGE — the container image clsi runs to convert
Prerequisites
Because conversions run as Docker containers spawned by clsi:
clsi must run in sandboxed mode with Docker access. In the dev stack clsi already has SANDBOXED_COMPILES=true and the host Docker socket (/var/run/docker.sock) mounted.
- The
PANDOC_IMAGE must be present on that Docker host (pulled or built locally) before the first conversion.
Quick setup
The dev stack (develop/dev.env) already ships with:
Since the official image is private, build the bundled one once before using the feature:
Then (re)start the stack so clsi and web pick up the variables.
Building the Pandoc image
A stock Pandoc image works because clsi invokes Pandoc generically (no custom templates/filters). It only needs three runtime essentials, all handled by develop/pandoc/Dockerfile:
Build and tag it so the tag matches PANDOC_IMAGE:
For production, pin pandoc/core to a specific version instead of latest for reproducible builds, and set PANDOC_IMAGE to your registry path.
Troubleshooting
Last modified on October 5, 2026