Parse Markdown form and generate serializable FlaskForm
Project description
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
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
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b33208e1e72e62f4ccd00f73be9463da0d877e7dde63b345930ab80fd20ffe1 |
|
MD5 | e0f9ca750b1e40f3d31f35ddf49ca276 |
|
BLAKE2b-256 | c6a4b32687d28235000197af3cb0fdc9b8cd19d4de313a93ece198b8cb9003a3 |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4720f69d69a526e99eaa49e69d0b3ad63452b4c678c9cb56de4553b5287ef2a4 |
|
MD5 | 91c7ec44ce6fef39f8692936fa3b9fbd |
|
BLAKE2b-256 | 1893b0a76bca8a9ecfacc84e499651895e6b663293fe8ec68934ac36223e4429 |