Skip to content
Rules for invoking Pandoc through the Bazel build system
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
sample Update documentation Dec 2, 2019
.cirrus.yml Added sample build to Cirrus YAML Nov 13, 2019
.gitignore Check in the initial version of the Bazel Pandoc rules. Oct 2, 2018

Bazel rules for Pandoc

This repository provides a function for the Bazel build system called pandoc() that invokes the Pandoc document converter. Example use cases include converting documentation written in Markdown to HTML files, or embedding them as chapters into LaTeX documents. These rules depend on the official release binaries provided by the Pandoc project.

Using these rules

Please see the sample folder for an example of how bazel-pandoc could be used.

Set up your workspace

Add the following to your WORKSPACE file:

    name = "bazel_pandoc",
    strip_prefix = "bazel-pandoc-<release>",
    url = "<release>.tar.gz",

load("@bazel_pandoc//:repositories.bzl", "pandoc_repositories")


Use the pandoc rule in BUILD files

You can then add directives along these lines to your BUILD.bazel files:

load("@bazel_pandoc//:pandoc.bzl", "pandoc")

    name = "foo",                # required
    src = "",              # required
    from_format = "markdown",    # optional, inferred from src extension by default
    to_format = "latex",         # optional, inferred from output extension by default
    output = "awesome_doc.tex",  # optional, derived from name and to_format by default

In the example above, an output file called awesome_doc.tex will be created in the bazel-bin directory.

At least one of the to_format or output attributes must be provided.

Platform support

These rules have been tested to work on:

  • macOS Mojave 10.14, building locally.
  • Ubuntu 18.04, building locally.
  • Ubuntu 18.04, building on a Debian 9 based Buildbarn setup.
  • Windows 10 1803, building locally.
  • Windows 10 1803, building on a Debian 9 based Buildbarn setup.
You can’t perform that action at this time.