Skip to main content

Convert reStructuredText to plain text

Project description

PyPi Status Build Status

reStructuredText is pretty-damn consumable in its raw form, but extensive use of directives and roles can hamper things or leave the document incomplete in its raw form (cough, .. include, cough).

rst2txt allows you to work around this by evaluating the reStructuredText source and stripping it of most of its formatting. The end result is a document that’s more readable and has elements that don’t make sense in a plain text document, such as images, stripped.

rst2txt is based on the sphinx.writer.text.TextWriter writer used by Sphinx’s TextBuilder but with the Sphinx-specific features stripped out.

Installation

rst2txt is available on PyPI. To install, run:

$ pip install --user rst2txt

Usage

Most users will want just the rst2txt application:

$ rst2txt README.rst

It is also possible to call this programmatically though. This can be useful for things like consuming README files:

from docutils.core import publish_file
import rst2txt

with open('README.rst', 'r') as source:
    publish_file(source=source, destination_path='README.txt',
                 writer=rst2txt.Writer())

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
rst2txt-1.1.0-py2.py3-none-any.whl (12.1 kB) Copy SHA256 hash SHA256 Wheel py2.py3
rst2txt-1.1.0.tar.gz (15.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page