Skip to main content

Parse Markdown form and generate serializable FlaskForm

Project description

Latest Version License Python Versions CI Coverage

flask-mdform

An extension for Flask to generate Flask-WTF parsing Markdown based document using mdforms. Checkout the syntax in the mdform page.

Installation

pip install flask-mdform

Usage

Use it like this to create a WTForm compatible template:

or use it like this to create a WTForm compatible template that uses Bootstrap4.

>>> from flask_mdform import Markdown, FormExtension, flask_wtf_bs4
>>> md = Markdown(extensions = [FormExtension(formatter=flask_wtf_bs4("jQuery", "wtf."))])
>>> html = md.convert(text)  # this is the jinja template with Flask WTForm and BS4
>>> form_dict = md.Form      # this is the definition dict

Here, the two arguments in the formatter can be use it to customize it. “jQuery” is the name of the jQuery variable, “wtf.” is the prefix where WTForm bootstrap form_field function is located.

Other functions

use_mdform: decorator to be used in a flask route to parse, display, load and store form and its values.

form_to_dict: iterates through a filled form and returns a dictionary with the values in a json compatible format.

dict_to_formdict: iterates through a dict, parsing each value using the spec defined in form_cls.

from_mdfile: generates form metadata, template, form from markdown file.

from_mdstr: generates form metadata, template, form from markdown string.

See AUTHORS for a list of the maintainers.

To review an ordered list of notable changes for each version of a project, see CHANGES

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-mdform-0.1.1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

Flask_mdform-0.1.1-py2.py3-none-any.whl (3.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file Flask-mdform-0.1.1.tar.gz.

File metadata

  • Download URL: Flask-mdform-0.1.1.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2

File hashes

Hashes for Flask-mdform-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2b33208e1e72e62f4ccd00f73be9463da0d877e7dde63b345930ab80fd20ffe1
MD5 e0f9ca750b1e40f3d31f35ddf49ca276
BLAKE2b-256 c6a4b32687d28235000197af3cb0fdc9b8cd19d4de313a93ece198b8cb9003a3

See more details on using hashes here.

File details

Details for the file Flask_mdform-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: Flask_mdform-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2

File hashes

Hashes for Flask_mdform-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4720f69d69a526e99eaa49e69d0b3ad63452b4c678c9cb56de4553b5287ef2a4
MD5 91c7ec44ce6fef39f8692936fa3b9fbd
BLAKE2b-256 1893b0a76bca8a9ecfacc84e499651895e6b663293fe8ec68934ac36223e4429

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