Textile parsing from within Flask
Project description
The Python port of Dean Allen's humane web text generator packaged for use with Flask.
pip install flask-textile
Import into our project:
from flask_textile import Textile
And then...
app = Flask(__name__)
textile = Textile(app)
Or, if one prefers, with an application factory:
textile = Textile()
def create_app(config_class=Config):
app = Flask(__name__)
app.config.from_object(config_class)
textile.init_app(app)
#...
Simple usage within a Jinja2 template:
{{ text|textile }}
Or use as a filter:
{% filter textile %}
h2. Textile
* is a _shorthand syntax_ used to generate valid HTML
* is *easy* to read and *easy* to write
* can generate complex pages, including: headings, quotes, lists, tables and figures
Textile integrations are available for "a wide range of platforms":/article/.
{% endfilter %}
Additionally, Flask-Textile offers a static method, parse()
, which returns a raw HTML sting from Textile input—i.e. the direct output of python-textile. (Useful for working with Textile outside of a template):
from flask_textile import Textile
Textile.parse(text)
# Or if you already have an instance laying around...
app = Flask(__name__)
textile = Textile(app)
#...
textile.parse(text)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file Flask-Textile-0.4.1.post1.tar.gz
.
File metadata
- Download URL: Flask-Textile-0.4.1.post1.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88045821b61b36a575ef86c130459b98426d2f060e94ed8b7c312d654b9f7af5 |
|
MD5 | 878271464dd1c0a948e00a80f3c11c90 |
|
BLAKE2b-256 | ee77eed21ce49ce73c99a25482b08a0a2934aebf8e19312dc214f9f37a570792 |
File details
Details for the file Flask_Textile-0.4.1.post1-py3-none-any.whl
.
File metadata
- Download URL: Flask_Textile-0.4.1.post1-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a53e5ef3c080baa8d097414f75634ef23d82a73527b1608ec1eb4724a022274d |
|
MD5 | 9cf9dbaa4b485da7c6f1c4051640a4ee |
|
BLAKE2b-256 | 2b401b863f597909e3ac5555dfb6e1a3f84a22adbe7403683c72290e7d0afeb3 |