Development Status
- 5 - Production/Stable
Environment
- Console
- Web Environment
Intended Audience
- Developers
- Education
- End Users/Desktop
- Science/Research
- System Administrators
License
- OSI Approved :: BSD License
Operating System
- OS Independent
Programming Language
- Python
- Python :: 2
- Python :: 2.7
- Python :: 3
- Python :: 3.4
- Python :: 3.5
- Python :: 3.6
- Python :: 3.7
- Python :: Implementation :: CPython
- Python :: Implementation :: PyPy
Topic
- Documentation
- Internet :: WWW/HTTP :: Site Management
- Printing
- Software Development
- Software Development :: Documentation
- Text Processing
- Text Processing :: General
- Text Processing :: Markup
- Utilities
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())