Skip to content

Commit

Permalink
Add a proper README on how to use the Pandoc rule.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Schouten committed Oct 3, 2018
1 parent 749804e commit 29dd425
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Bazel rules for Pandoc

This repository provides a function for
[the Bazel build system](https://bazel.build/) called `pandoc()` that
invokes [the Pandoc document converter](https://pandoc.org/). 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

Add the following to your `WORKSPACE` file:

```python
http_archive(
name = "bazel_pandoc",
sha256 = "<checksum>",
strip_prefix = "bazel-pandoc-<release>",
url = "https://github.com/ProdriveTechnologies/bazel-pandoc/archive/v<release>.tar.gz",
)

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

pandoc_repositories()
```

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

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

pandoc(
name = "foo",
src = "foo.md",
from_format = "markdown",
to_format = "latex",
)
```

In the example above, an output file called `foo.tex` will be created in
the `bazel-bin` directory. The `to_format` field is used to
automatically derive a file extension of the output file.

0 comments on commit 29dd425

Please sign in to comment.