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({}), [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({}), [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.

Project details


Download files

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

Source Distribution

pandoc-2.0a4.tar.gz (29.8 kB view details)

Uploaded Source

File details

Details for the file pandoc-2.0a4.tar.gz.

File metadata

  • Download URL: pandoc-2.0a4.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200325 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for pandoc-2.0a4.tar.gz
Algorithm Hash digest
SHA256 d91eff23eb7e687e1168dd4f0aefe3764f6160e19f1d690d464b67cdd6690b3e
MD5 c05e35ce2e9ef4e753a77cdec7e99bf7
BLAKE2b-256 6762629957bddb07a5c1e975f71f4fe482542eb03113522b5ff71ca18e522cdb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page