From 29dd425b72ee165d6605bdc41d9f78318f2d8abe Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Wed, 3 Oct 2018 09:15:39 +0200 Subject: [PATCH] Add a proper README on how to use the Pandoc rule. --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4e7a39e --- /dev/null +++ b/README.md @@ -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 = "", + strip_prefix = "bazel-pandoc-", + url = "https://github.com/ProdriveTechnologies/bazel-pandoc/archive/v.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.