Add commonmark processing filter to your Flask app.
Project description
flask-commonmark
Add CommonMark processing filter to your Flask
app.
One may notice a similarity to Dan Colish's Flask-Markdown
, from which I shamelessly copied a bunch of this. Does not have all the nice provisions for extension baked in, but probably does what you need.
Source code may be found at Gitlab.
Docs at readthedocs.
Installation
pip install Flask-Commonmark
If pip
is not available on your system, use:
easy_install Flask-Commonmark
Usage
Script
from flask_commonmark import Commonmark
cm = Commonmark(app)
or, if you are using factory pattern:
cm = Commonmark()
cm.init_app(app)
Create routes in the usual way:
@app.route("/commonmark")
def display_commonmark():
mycm = u"Hello, *commonmark* block."
return render_template("commonmark.html", mycm=mycm)
Template
Inline-style
<html>
{{mycm|commonmark}}
</html>
Block-style
<html>
{% filter commonmark %}
{{mycm}}
{% endfilter %}
</html>
Autoescape
Jinja2's autoescape works as expected. See tests for examples.
Tests
python setup.py test
or nosetests
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Flask-Commonmark-1.0.1.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for Flask_Commonmark-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4f09df4ba151797482517017e5762f2310e046f7ac124458ad2f2dc6641441c |
|
MD5 | 18ca645bc03790dbeb04e4e1b81e34b4 |
|
BLAKE2b-256 | e91aee45b58b62abe84354a5d921a8d87e6abc8109035d7f3c38c2bd45e947a8 |