Skip to main content

Parse Markdown form and generate useful templates and data.

Project description

Latest Version License Python Versions CI Coverage


An extension for python-markdown to generate parse a form in Markdown based document.

This document:

Please fill this form:

name* = ___
email = @

And also this important question:

Do you like this = () YES () NO

will generate the following jinja template:

Please fill this form:

{{ }}
{{ }}

And also this important question:

{{ form.do_you_like_this }}

and this dict:

that you can consume to generate a form.


pip install mdform



The syntax is strongly based on this wmd fork.

Text fields

name = ___


name = ___[50]

Exactly 3 underscores will be matched. Any more will be handled as standard underline directives.

Text area

name = |||


name = |||[50]

Exactly 3 slashes will be matched.

Radio buttons

sex = (x) male () female

The option with an x will be the default.

Check boxes

phones = [] Android [x] iPhone [x] Blackberry

The option with an x will be the default.

File Field

name = ...


name = ...[png]
name = ...[png,jpg]
name = ...[png,jpg;Only image files]

Required fields

To flag a field as required, just add an asterisk after the name.

zip code* = ___


In certain cases is useful to create a named section.


name = ___


name = ___

will render as:

{{ form.university_name }} {{ form.school_name }}


{'university_name': {'type': 'StringField',
                     'required': True,
                     'length': None
 'school_name': {'type': 'StringField',
                 'required': True,
                 'length': None

Collapsable parts

In certain cases is useful to create a part of the form which collapses based on the value of a dropdown box. Just use the modifier [c] for the dropdown item that will collapse the part of the html and enclose the collapsable part as shown:

extra = {Yes, (No[c])}


name = ___


The extra in the collapse tag indicates which dropdown box is used as control.

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.

Files for mdform, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size mdform-0.2-py2.py3-none-any.whl (9.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size mdform-0.2.tar.gz (10.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page