-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Pandoc Filters
Christophe Demko edited this page Feb 24, 2021
·
141 revisions
Pandoc provides an interface for users to write programs (known as filters) which act on the intermediate AST. For more info see the filter tutorial and the Lua filter tutorial.
This page collects together third party filters which can be used to add functionality to pandoc.
Filters can be written in any programming language. Pandoc wrappers and interfaces are available in the following programming languages to facilitate modification of the AST:
language | link | description |
---|---|---|
Python | pandocfilters | a library for writing pandoc filters in python. |
Python | panflute | a pythonic alternative to pandocfilters , with batteries included. It reconstructs pandoc AST in an internal panflute AST which makes it more seamless in interacting with the AST. (@jgm recommended this in pandoc discuss) |
Python | pantable | specialized in writing filter for tables based on panflute, which provides a lossless conversion between an internal structure and panflute AST. |
PHP | pandocfilters-php | a port of the python pandocfilters module to PHP to make writing filters in PHP easier. |
Node.js | pandoc-filter-node | a Node.js module for writing pandoc filters in JavaScript. |
Perl | Pandoc::Elements | a CPAN module for writing pandoc filters in Perl. |
Groovy | groovy-pandoc | a library for writing Pandoc filters in Groovy. |
Ruby | paru | a Ruby gem to write pandoc filters in Ruby. |
Lua | pandoc's official documentation | Pandoc includes a lua interpreter by default so is quite lightweight |
Elixir | Panpipe | a library for writing pandoc filters in Elixir |
.NET | PandocFilters | a NuGet package for writing Pandoc filters in .NET languages |
Other tools:
- vimhl, a vim plugin that makes vim syntax highlighting engine available in pandoc.
- pandoc-jats, a Lua custom writer for Pandoc generating JATS XML.
- 2bbcode, a Lua custom writer for BBCode.
- pandocmeta.lua, a simple Lua package that converts Pandoc metadata types into a, possibly multi-dimensional, table.
See github.com/pandoc/lua-filters for some select filters written in Lua. Some other known 3rd party filters:
- Because DOCX and ODT files cannot use templates, we are limited in how we can transform metadata into document content. Several paru filters can help to solve this, given a metadata format involving authors with affiliation/correspondence fields and institute information: README; and individual filters: simplifyMetadata, prependInstitute, prependKeywords, prependAbstract, prependComments --- filters combined: prependAll.
- pandoc-svg, a pandoc filter to convert svg files to pdf by Jerome Robert.
- diagrams-pandoc for inserting images expressed in the Haskell diagrams DSL.
- mermaid-pandoc for inserting images expressed in mermaid syntax
- r-pandoc for inserting plots expressed in the R language
- paru-screenshot.rb for automatically taking a screen shot of a web page and including that shot as an image in a markdown file.
- pandoc-plot to generate and embed figures based on code blocks in documents, using a variety of toolkits (e.g. Matplotlib, MATLAB, gnuplot, ggplot2, etc.). Easy integration with Haskell libraries (e.g. Hakyll)
-
Numerical reference to
sections, using a
specified sign (by default
#
) in internal links. Metadata can configure special sign and whether links should be preserved or converted to plain text. - pandoc-fignos, for numbering figures and figure references.
- pandoc-eqnos, for numbering equations and equation references.
- pandoc-tablenos, for numbering tables and table references.
- pandoc-crossref, for numbering and cross-referencing figures, equations and tables
- pandoc-numbering, for numbering and cross-referencing any kinds of things such as examples, theorems, exercises and so on
- pandoc-ling, for formatting, numbering and cross-referencing linguistic examples
- pandoc-listof, for creating lists of any kinds (deprecated)
- pandoc-amsthm: a pandoc amsthm package to define the use of amsthm through YAML front matter, target at HTML and LaTeX outputs. For HTML, CSS counter is used and defined in a template (by the YAML variables). For LaTeX amsthm package is used and defined in a template (by the YAML variables). - definitionlist-filter.lua, for converting some definition lists to theorem-like (amsthm) Environments and some references to cref tags in LaTeX
- mathjax-pandoc-filter rendering math to SVG using mathjax-node
- asciimathml-pandocfilter: to add read support for AsciiMathML syntax through conversion into LaTeX
-
pandoc-unicode-math
replaces Unicode math symbols and greek letters like ∀, ∈, →, λ, or
Ω in math environments by equivalent Latex commands like
\forall
,\in
,\rightarrow
,\lambda
, or\Omega
. - SugarTeX is a more readable LaTeX language extension and transcompiler to LaTeX. Fast Unicode autocomplete in Atom editor via SugarTeX Completions for Atom.
- Using markdown inside raw latex commands
-
pandoc-latex-environment,
for adding LaTeX environment on specific HTML
div
tags -
latexdivs.py:
define a syntax to turn any native pandoc Divs into a LaTeX
environment: if
latex="true"
is in the attribute of the Div, the first class is used to define the LaTeX environment. -
pandoc-latex-tip, for
decorating specific
span
,code
,div
andcodeblock
elements by icons taken from popular icon collections. -
pandoc-latex-admonition,
for decorating specific
div
andcodeblock
elments by admonitions - pandoc-latex-barcode: insert a barcode or a QR code into a latex/PDF document.
-
pandoc-latex-fontsize,
for specifying LaTeX font size on
span
,code
,div
andcodeblock
elements -
pandoc-latex-color,
for specifying X11 color on
span
anddiv
elements - pandoc-latex-unlisted, for unlisting some specific headers in the table of contents (deprecated since it is now in the core of pandoc)
- pandoc-latex-newpage, for converting horizontal rules into new page
- pandoc-latex-french-spaces, for dealing with french spaces around some punctuation marks
-
pandoc-latex-margin,
for setting left and right margins on
div
andcodeblock
elements -
pandoc-beamer-block,
for using
block
,alertblock
andexampleblock
environment defined in beamer.
- Include Files: finds all the inline code blocks with attribute include, and replaces their contents with the contents of the file given
- code-includes.lua Include code from source files. Keep your examples and documentation compiled and in-sync. Similar to the above except you don't have to install Haskell and you can select by line number.
- pandoc-dot2tex-filter - a filter that converts dot notation to PGF/TikZ graphics for latex/pdf rendering.
- HTML comment to LaTeX comment: a filter that converts HTML comment to LaTeX comments
- pandoc-csv2table for including referenced csv files in markdown as markdown rendered tables.
-
pandoc-placetable
lightweight implementation of the idea behind the above
pandoc-csv2table
(e.g. doesn't necessarily require pandoc as a cabal dependency) - ickc/pantable: CSV Tables in Markdown: Pandoc Filter for CSV Tables: a Python alternatives to the above 2 filters, using panflute, with some enhancements (e.g. auto-width, fractional width, etc.)
- Creating a link table at the end of your document. - pandocsql run SQL queries on tables, generating other tables
- pandoc-abbreviations allows the use of arbitrary abbreviations, defined in an abbreviations file or in the source document's YAML header, which are replaced on processing. Useful for maintaining consistency of terminology etc.
- pandoc-acronyms is a filter for managing acronyms. It replaces acronyms like "FAQ" at first use with the full text "frequently asked questions (FAQ)". It is installed using pip.
- count-para.lua add numbering to paragraphs to allow for detailed citation (in scientific context). Proposal to replace page-number referencing, which does not work with adaptive design.
- pandoc-lang automatically detects the (natural) language of text, as well as the programming language of code blocks
-
pandoc-mustache
replaces variables like
{{varname}}
in a pandoc document with their values, which are stored in a separate YAML file. - pandoc-quotes.lua and the older pandoc-quotes replace non-typographic, quotation marks with typographic ones for languages other than US English.
- transclude.lua Include content from another file just like in AsciiDoc and ReST.
- columns Multiple columns support.
- R-pandoc for generating R plots
- filter_pandoc_run_py for executing python codes written in code blocks and also embedding print output and pyplot figures
- pandoc-plot to generate and embed figures based on code blocks in documents, using a variety of toolkits (e.g. Matplotlib, MATLAB, gnuplot, ggplot2, etc.). Easy integration with Haskell libraries (e.g. Hakyll)
- Knitty: is a Pandoc filter for reproducible reports via Jupyter and Pandoc (Stitch's fork that is a Knitr-RMarkdown-like lib). Insert Python code (or other Jupyter kernel code) to the Markdown document or write in plain Python/Julia/R/any-kernel-lang with block-commented Markdown and have code's results in the Pandoc output document.
- pandocsql which uses an in-memory SQLite database. It creates tables from tables in the document and executes queries in code blocks, showing the results as tables.
-
pandoc-manubot-cite
allows citing persistent identifiers directly like
@doi:10/c7np
or@pubmed:29618526
. Removes the need for a reference manager by supporting DOIs, PubMed IDs, URLs, ISBNs, Wikidata IDs, and the hundreds of other ID types registered with https://identifiers.org. Written in Python. Available on PyPI. - pandoc-url2cite allows citing certain persistent identifiers directly (URLs, ISBNs, and DOIs). Basically a less opinionated and simpler version of pandoc-manubot-cite. Written in TypeScript. Available on npm.
- pandoc-zotxt.lua looks up sources for citations in Zotero.
-
Adding
support
for indexing with the syntax
(# term, subterm)
in html and latex - Adding non-breaking spaces inside a URL to preserve formatting
- lablinkfix updates links to the Swedish Labour Movement Archives and Library catalogues.
-
second-date
changes
date
metadata to a different strftime format using python's dateutil. - pandoc_abnt allow to specify the source of images and tables, and automatically corrects Alineas according to Brazilian's standard for Academic writings (ABNT NBR 14724:2011).
- pandoc-refheadstyle sets a custom style for the reference section header; there's a Lua version, too: pandoc-refheadstyle.lua
- nheengatu provides several resources for publishing multimedia content through formats such as LaTeX, HTML and EPUB.
- code-includes.lua Include code from source files. Keep your examples and documentation compiled and in-sync.