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)

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

Uploaded Source

Built Distribution

Flask_Commonmark-1.0.4-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: Flask-Commonmark-1.0.4.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.3

File hashes

Hashes for Flask-Commonmark-1.0.4.tar.gz
Algorithm Hash digest
SHA256 9cc24bd74d9f2611a3869c5b311a6efc6287f5dbb4b2ff67511776fb14fa2914
MD5 7459f5f7a210e57f736039c91a4a363b
BLAKE2b-256 0ffc94259ecee4d39ed98b641d1c67a3bc2ddcd9c07e1bbcfc9440e7937840a9

See more details on using hashes here.

File details

Details for the file Flask_Commonmark-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: Flask_Commonmark-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.3

File hashes

Hashes for Flask_Commonmark-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 03ab495bc331c51dacaa3e92e2e8c62427f0b4053ec327f5058528bc8d28db1a
MD5 4b6350538db021f30b87fc5e50450a79
BLAKE2b-256 df1796e55c4909ce0c6f8655f3d1abcb7d850ce361b46717235f195a5bc767a5

See more details on using hashes here.

Supported by

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