Skip to main content

Pandoc Documents for Python

Project description

Pandoc – 🐍 Python Library

Python PyPI version Mkdocs GitHub discussions Downloads GitHub stars build

🚀 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.2.tar.gz (29.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: pandoc-2.2.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/0.0.0 CPython/3.10.4

File hashes

Hashes for pandoc-2.2.tar.gz
Algorithm Hash digest
SHA256 d063ee252f2761010f16cf3a14912ad9245187c24c56f4b1ad9696e104fe6e1e
MD5 64da6fcf3eb18533f22164815dea37f0
BLAKE2b-256 d4069fddb7efb027b2facabdb3eb18d6350e2890470740c580a2a0fff87ff8ea

See more details on using hashes here.

Supported by

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