Pandoc WebAssembly (WASM)
361
This Docker image, part of the pandoc-wasm project, provides a self-contained toolchain for building the WebAssembly (WASM) version of Pandoc, the universal document converter.
The image is based on Ubuntu 22.04 and comes with:
The image compiles the wasm branch of the haskell-wasm/pandoc repository into a pandoc.wasm binary, and then optimizes the output with wasm-opt to reduce size.
Use this image if you want a reproducible, ready-to-run environment for producing a WASM build of Pandoc without setting up the full toolchain on your host.
This image is built from the Dockerfile in the pandoc-wasm repository. This provides details on how the toolchain is set up and how Pandoc is built.
The primary use case is to build and copy out the optimized pandoc.wasm artifact.
Build the Docker image from this directory:
docker build -t pandoc-wasm .
Run the container (it exits when the build finishes):
docker run --name pandoc-container pandoc-wasm
Copy the pandoc.wasm file from the container to your host:
docker cp pandoc-container:/pandoc.wasm .
(Optional) Clean up the stopped container:
docker rm pandoc-container
You now have pandoc.wasm available on your machine for use with any WASM runtime.
If Wasmtime is installed on your host and you have copied pandoc.wasm, you can run it directly:
Create a sample file:
echo '# Local Hello' > local.md
Run Pandoc (WASI):
wasmtime run --dir .::/ ./pandoc.wasm local.md -o local.html
The --dir .::/ flag grants the module access to the current directory.
You can also start an interactive session in the build image to test pandoc.wasm without copying it out:
Start a shell:
docker run -it --rm pandoc-wasm bash
Create a sample Markdown file:
echo '# Test Markdown' > test.md
Convert using wasmtime and the built pandoc.wasm:
wasmtime run --dir /::/ /pandoc.wasm /test.md -o /test.html
Verify the output:
ls -l /test.html
Content type
Image
Digest
sha256:baffa29e0…
Size
2.5 GB
Last updated
about 1 year ago
docker pull shenlu89/pandoc-wasm