Skip to main content

A workflow automation wrapper for Pandoc.

You’ve got exciting.md and want a pdf with LuaLaTeX, bibliography support?

panopy pdf exciting.md

Want a self-contained html with Bootstrap too?

panopy html exciting.md

Installation

pip install panopy

Purpose

Pandoc requires a large number of command-line arguments to generate any output format. Typical solutions have been to use makefiles or YAML configurations to specify what pandoc should do, along with pre/post-processors to clean up pandoc’s shortcomings. This can get messy.

panopy’s philosophy is to separate contents from workflow. Content should try as hard as it can to be agnostic to its output format. Likewise, the file system should segregate content from the tools needed to process it. Instead of makefile and document-embedded output specifications, panopy uses global YAML templates to specify workflows around any given input file, combined with a global script to process it all. So you can write a single markdown file and push it to whatever formats you need.

At the present moment, panopy is a barebones wrapper allowing for a series of preprocessing commands, a pandoc command and a series of postprocessing commands. I can’t vouch for its ability to process multiple input files into a single output. I also doubt that pandoc is fast enough to be an online processor for multiple files.

Usage

Panopy looks for a default YAML template file in ~/.pandoc/panopy.templates. Currently there is no way to change this location. A sample file might looks something like:

__default__:
    s:
    S:
    r: markdown+yaml_metadata_block

latex:
    o: %.tex
    bibliography: ~/Documents/library.bib
    filter:
        - pandoc-citeproc

pdf:
    __inherits__: latex
    o: %.pdf
    latex-engine: pdflatex

fancypdf:
    __inherits__: pdf
    __pre__:
        - gpp -o %.gpp.md %.md
    __in__: %.gpp.md

The __default__ template sets options -s (standalone), -S (smart), and -r markdown+yaml_metadata_block for all files. The latex template changes the default output format to tex and adds pandoc’s bibliography processing filter. The pdf template inherits all settings from latex but changes the output to pdf and sets the latex engine. The fancypdf template updates pdf to preprocess the input file with gpp and changes the input file to pass to pandoc.

Now just find your input file in the terminal and type:

panopy fancypdf input.md

And if you use vim:

:!panopy fancypdf %

```

Panopy Keywords

Special templates:

  • __default__: provides the default template that all others inherit from

Keywords in template:

  • %: auto-replaced by base file name: panopy pdf infile.md with template option -o: %.pdf becomes -o infile.pdf. Escape with \%

  • __inherits__: inherit from named template(s)

  • __in__: specifies input file format

  • __pre__: specifies commands to run before pandoc

  • __post__: specifies commands to run after pandoc

  • __clear__: specifies which inherited options to clear

Similar

  • panzer allows you to specify styles at the file level (YAML metadata), while panopy specifies a workflow at the command line. I made panopy because I wanted to keep my YAML clean and sort of tool agnostic.

  • Makefiles: see e.g. Kieran Healy’s solution

Release files for panopy 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for panopy 0.2.4
File Size Uploaded
panopy-0.2.4.tar.gz 5.0 kB Details

Release files / panopy-0.2.4.tar.gz

Download URL panopy-0.2.4.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5be2e9014ffd067ad2b24054c17e901453b82f60bdbafe76ac6a0baff166a837
BLAKE2b-256 checksum
How to use checksums
57da5a6819921cb27c6639c0855c051f27636d494233046ae920206fecc5e765
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.4 This release

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page