pyandoc

0.2.0 · abandoned · verified Sun Apr 12

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

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a `pandoc.Document` object, assign content in Markdown, and then convert it to other formats like reStructuredText and HTML by accessing the respective properties. Ensure Pandoc is installed separately on your system for `pyandoc` to function.

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)

view raw JSON →