skip to navigation
skip to content

Not Logged In

pandocwheels 0.1.1

Python wrapper and AST filters for Pandoc

This library provides a simple Python wrapper for Pandoc, a universal document converter. The wrapper is made up by two main functions: to make Pandoc AST from given document and the other way around.

Unlike other wrappers which do not expose the AST (ie., Pandoc's internal representation of a document), pandocwheels encourages you to do extra processing by using AST filters. Several such filters are included in the library, eg. for code highlighting via Pygments.

To know more, read the docs or see the example below. If you find a bug, please let me know on GitHub.

pandocwheels is available under the MIT license (see LICENSE.txt).


You're going to need Pandoc >=1.12 and Setuptools. Then it's just pip install pandocwheels or python pandocwheels. Make sure Pandoc's executable is in your PATH, or set pandocwheels.PANDOC accordingly (see the docs).

pandocwheels uses six to run on both Python 2 and 3. It has been tested on Python 2.7 and 3.3.

Code Example

Convert some Markdown to HTML 5 with MathJax and Pygments code highlighting:

import pandocwheels
from pandocwheels.pygmentize import pygmentize

document = r"""
The factorial function

The factorial of number $n$ is defined as $n! = 1 \cdot 2 \cdots n$.

Here is a naive Python implementation:

def fact(n):
    return 0 if n == 0 else n*fact(n-1)

ast = pandocwheels.read_into_ast(document, "markdown")
ast = pandocwheels.apply_filter(ast, pygmentize, "html5")
with open("factorial.html", "w") as fp:
    args = ["--standalone", "--mathjax", "--css=pygments.css"]
    pandocwheels.convert_ast(ast, "html5", fp, extra_args=args)
File Type Py Version Uploaded on Size
pandocwheels-0.1.1.tar.gz (md5) Source 2014-01-18 21KB
  • Downloads (All Versions):
  • 1 downloads in the last day
  • 38 downloads in the last week
  • 173 downloads in the last month