Pandoc Documents for Python
Project description
Pandoc (Python Library)
🚀 Getting started
Install Pandoc first, for example with conda:
$ conda install -c conda-forge pandoc
Then, install the Pandoc Python Library with pip:
$ pip install --upgrade pandoc
🌌 Overview
Pandoc is the awesome open-source command-line tool that converts documents from one format to another. The project was initiated by John MacFarlane; under the hood, it's a Haskell library.
The Pandoc Python Library brings Pandoc's document model 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
Release history Release notifications | RSS feed
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.4.tar.gz
(34.6 kB
view details)
File details
Details for the file pandoc-2.4.tar.gz
.
File metadata
- Download URL: pandoc-2.4.tar.gz
- Upload date:
- Size: 34.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecd1f8cbb7f4180c6b5db4a17a7c1a74df519995f5f186ef81ce72a9cbd0dd9a |
|
MD5 | d2e9236dead8427ea9a1653ba8123b37 |
|
BLAKE2b-256 | 109ae3186e760c57ee5f1c27ea5cea577a0ff9abfca51eefcb4d9a4cd39aff2e |