Textile
Textile is a Python port of Dean Allen's humane web text generator, allowing conversion of Textile-formatted text into HTML. The library is currently in active development, with version 4.0.3 released in September 2024, and receives periodic updates to maintain compatibility and introduce improvements.
Warnings
- breaking Python 2.x and older Python 3.x versions (3.2, 3.3, 3.4) are no longer supported. Users on these environments should use Textile Version 3.0.
- breaking The underlying HTML sanitization library was switched from `html5lib` to `nh3`. This might subtly change sanitization behavior for some inputs.
- gotcha The `regex` package, an optional dependency, can cause compatibility problems when running `textile` in PyPy environments. If you encounter issues, uninstall `regex`.
Install
-
pip install textile -
pip install 'textile[imagesize]'
Imports
- textile
import textile
Quickstart
import textile textile_input = """ _This_ is a *test.*\n * One * Two * Three Link to "Slashdot":http://slashdot.org/ """ html_output = textile.textile(textile_input) print(html_output)