Add commonmark processing filter to your Quart app.
Project description
quart-cmark
Add CommonMark processing filter to your Quart
app, using paka.cmark because why should I do any work?
paka.cmark
uses the commonmark/cmark reference implementation, so it should render anything outlined in the CommonMark Spec lickety-split.
Source code may be found at Gitlab.
Docs at readthedocs.
Installation
pip install Quart-Cmark
Usage
Script
from quart_cmark import Cmark
cm = Cmark(app)
or, if you are using factory pattern:
from quart_cmark import Cmark
cm = Cmark()
cm.init_app(app)
Create routes in the usual way:
@app.route("/markdown-fest")
async def markdown_fest():
mycm = u"Hello, *commonmark* block."
return await render_template("markdown-fest.html", mycm=mycm)
Template
Inline-style
<html>
{{mycm|commonmark}}
</html>
Block-style
<html>
{% filter commonmark %}
{{mycm}}
{% endfilter %}
</html>
Autoescape
Jinja2's autoescape works when declared at init. See tests for examples.
Tests
pytest
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
Quart-Cmark-0.1.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for Quart_Cmark-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3db3ddafdb7ba46ffa5b877451ddc17b2bc25286395a8af0bae3c62c79ad857e |
|
MD5 | 0479725ae34b83e4af0d40232450b6cb |
|
BLAKE2b-256 | f2fec03c6d62433d6b52e238aa966d1338a0f9cecc617f72cf13e5a897489869 |