Skip to main content

Pandoc Documents for Python

Project description

Pandoc – 🐍 Python Library

Python PyPI version Mkdocs GitHub discussions Downloads GitHub stars

linux macos windows

🚀 Getting started

Pandoc – the general markup converter (and Haskell library) written by John MacFarlane – needs to be available. You may follow the official installation instructions or use conda:

$ conda install -c conda-forge pandoc

Then, install the latest stable version of the pandoc Python library with pip:

$ pip install --upgrade 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!

For more information, refer to the 📖 documentation.

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.3.tar.gz (33.2 kB view details)

Uploaded Source

File details

Details for the file pandoc-2.3.tar.gz.

File metadata

  • Download URL: pandoc-2.3.tar.gz
  • Upload date:
  • Size: 33.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.8.2 requests/2.28.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.8.8

File hashes

Hashes for pandoc-2.3.tar.gz
Algorithm Hash digest
SHA256 e772c2c6d871146894579828dbaf1efd538eb64fc7e71d4a6b3a11a18baef90d
MD5 df89df682ef745b8eb1ff4c1008c3f65
BLAKE2b-256 c52f19a65b7cb6b8d1000c6934a904f7b1f52c33b63115d6dce231738b0712f3

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