Skip to main content

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)

@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.

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-0.7.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file Flask-Commonmark-0.7.tar.gz.

File metadata

  • Download URL: Flask-Commonmark-0.7.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for Flask-Commonmark-0.7.tar.gz
Algorithm Hash digest
SHA256 06c33a7d40c9b463b60db8806383ca36c4f758a9afee51e1b03ff3a24a9037ac
MD5 593cd0153b37e6f5c93fcd2e863d823d
BLAKE2b-256 ae0e7af1f918266ecd9fc611402e3b168258e6f927414c0acbc4955bb615e517

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page