pandoc

Pandoc Documents for Python

MIT License 30 个版本
Sébastien Boisgérault <Sebastien.Boisgerault@minesparis.psl.eu>
安装
pip install pandoc
poetry add pandoc
pipenv install pandoc
conda install pandoc
描述

Pandoc (Python Library)

Python PyPI version Mkdocs GitHub discussions Downloads GitHub stars

linux macos windows

🚀 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.

版本列表
2.4 2024-08-07
2.3 2022-11-23
2.2 2022-04-20
2.1 2022-02-16
2.0.1 2021-12-04
2.4b0 2023-04-19
2.0a4 2020-04-05
2.0a3 2020-04-05
2.0a2 2020-03-28
2.0a1 2020-03-28
1.1.0 2021-06-28
1.0.2 2017-10-08
1.0.1 2017-10-08
1.0.0-alpha.3 2014-09-14
1.0.0-alpha 2014-03-22
1.0.0 2017-10-08
1.0.0b3 2017-10-02
1.0.0b2 2016-03-24
1.0.0b1 2016-03-18
1.0.0a8 2015-02-03
1.0.0a7 2015-02-03
1.0.0a6 2015-02-03
1.0.0a19 2016-03-18
1.0.0a18 2016-03-18
1.0.0a17 2016-03-17
1.0.0a16 2016-03-15
1.0.0a14 2016-02-19
1.0.0a13 2016-02-19
1.0.0a12 2016-02-14