pyandoc
pyandoc is an unmaintained Python wrapper for Pandoc, the universal document converter. It allows for converting text document formats by interacting with a Document object's attributes. The last release was version 0.2.0 in February 2016, and the project is no longer actively developed. Users seeking a current Pandoc wrapper for Python should consider 'pypandoc' instead.
Warnings
- breaking Project is abandoned and unmaintained. pyandoc has not been updated since February 2016. It is highly likely to be incompatible with recent Python versions (3.6+) and newer Pandoc releases, leading to runtime errors or unexpected behavior.
- gotcha Lack of direct Pandoc installation. pyandoc is just a wrapper; it does not install Pandoc itself. Users must manually install Pandoc and ensure it's available in their system's PATH for pyandoc to work. Failure to do so will result in errors when attempting conversions.
- deprecated Python 2.x compatibility. While pyandoc was released with Python 2.6-3.5 compatibility, Python 2.x is officially end-of-life. Using pyandoc in a modern Python 3 environment without legacy shims is not recommended and may cause issues.
Install
-
pip install pyandoc
Imports
- Document
import pandoc doc = pandoc.Document()
Quickstart
import pandoc
# Ensure Pandoc is installed and accessible in your system's PATH.
# For example, on Ubuntu/Debian: sudo apt-get install pandoc
# Or refer to Pandoc's official installation guide.
# Create a Document object
doc = pandoc.Document()
# Assign Markdown content
doc.markdown = '''# Hello from pyandoc
* This is a list item
* Another item with **bold** text'''
# Convert to reStructuredText
rst_output = doc.rst
print("\n--- reStructuredText Output ---\n")
print(rst_output)
# Convert to HTML
html_output = doc.html
print("\n--- HTML Output ---\n")
print(html_output)