Skip to content
Switch branches/tags


Failed to load latest commit information.
Latest commit message
Commit time

Pandoc (Python Library)

build Downloads Gitter chat

This README is about the 2.x branch of the library (alpha stage!). Only the 1.x branch is available on PyPi at the moment.

Getting started

Install the latest version with:

$ pip install --upgrade git+

The Pandoc command-line tool is a also required dependency ; you may install it with :

$ conda install -c conda-forge pandoc


This project brings Pandoc's data model for markdown documents to Python:

$ echo "Hello world!" | python -m pandoc read 
Pandoc(Meta({}), [Para([Str('Hello'), Space(), Str('world!')])])

It can be used to analyze, create and transform documents, in Python :

>>> import pandoc
>>> text = "Hello world!"
>>> doc =
>>> doc
Pandoc(Meta({}), [Para([Str('Hello'), Space(), Str('world!')])])

>>> paragraph = doc[1][0]
>>> paragraph
Para([Str('Hello'), Space(), Str('world!')])
>>> from pandoc.types import Str
>>> paragraph[0][2] = Str('Python!')
>>> text = pandoc.write(doc)
>>> print(text)
Hello Python!

Pandoc is the general markup converter (and Haskell library) written by John MacFarlane.