Home

Awesome

Panrun

Minimal script that runs pandoc with the options it finds in the YAML metadata of the input markdown file. For example:

panrun input.md

with the following input.md:

---
title: my document
output:
  html:
    standalone: true
    output: test.html
    include-in-header:
      - foo.css
      - bar.js
  latex:
    toc: true
    toc-depth: 3
    output: test.pdf
    template: letter.tex
    metadata:
      fontsize: 12pt
---

# my content

Will execute:

pandoc test.md --standalone --output test.html --include-in-header foo.css --include-in-header bar.js

Note how panrun defaults to using the first key in the YAML, in this case html.

Usage

panrun input-file [pandoc-options]

You can also supply more options, but only after the input file. They will be forwarded to pandoc. Panrun also looks at the -o (--output) and -t (--to) options to determine the output format. For example:

panrun input.md -t latex -o test.pdf

Panrun will only look at the YAML in the first input-file, but more are passed along to pandoc:

panrun 01.md 02.md 03.md -o output.pdf

Thus panrun *.md will work, as long as the YAML is found in the alphabetically first file.

The input-file doesn't even have to be a markdown file. As long as it starts with a YAML block, it should work.

Defaults and document types

If you put some YAML in ~/.panrun/default.yaml (see panrun -h for the Windows location), panrun will merge this with the YAML in your input file and add the --metadata-file option when calling pandoc. The YAML should be in the same format as always, for example:

---
author: Always Me
output:
  html:
    standalone: true
---

Finally, you can e.g. put type: letter in the YAML of your input document. In that case, panrun will look for ~/.panrun/letter.yaml instead of default.yaml.

Design

Installation

  1. Download panrun

  2. Place the file somewhere on your PATH (e.g. in /usr/local/bin/)

  3. Make sure the file has no extension and make it executable. On macOS/Linux (for Windows read this):

    chmod +x ./panrun