Skip to main content

Pandoc Documents for Python

Project description

Pandoc (Python Library)

Travis CI Build Status AppVeyor Build status

This README is about the 2.x branch of the library (alpha stage!).

Getting started

Install the latest version with:

$ pip install --upgrade git+https://github.com/boisgera/pandoc.git

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

$ conda install -c conda-forge pandoc 

Overview

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

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

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

>>> import pandoc
>>> text = "Hello world!"
>>> doc = pandoc.read(text)
>>> doc
Pandoc(Meta(map()), [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!')
>>> pandoc.write(doc)
'Hello Python!\n'

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pandoc, version 2.0a3
Filename, size File type Python version Upload date Hashes
Filename, size pandoc-2.0a3.tar.gz (37.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page