-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a proper README on how to use the Pandoc rule.
- Loading branch information
Ed Schouten
committed
Oct 3, 2018
1 parent
749804e
commit 29dd425
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |