bittobennichan / Flask-MDE

Markdown editor with WTForms integration for Flask

Home Page:https://flask-mde.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flask-MDE: Pagedown for Flask

Release v1.2.1 | Example application

https://img.shields.io/pypi/v/flask_mde https://img.shields.io/pypi/l/flask_mde https://img.shields.io/pypi/pyversions/flask_mde https://readthedocs.org/projects/flask-mde/badge/?version=latest https://pepy.tech/badge/flask-mde

Pagedown Editor with Google code-prettify for Flask. WTForms integration supported. From v1.2.0 Flask-MDE supports pagedown-extra.

Pagedown is a Markdown editor and previewer popularised by its use on StackOverflow. You can use the Flask-MDE extension to integrate the Pagedown editor into your Flask application.

Installation

Installing Flask-MDE is simple with pip. To install Flask-MDE, run the command

pip install Flask-MDE

in your terminal

Basic Usage

Assuming the following folder structure:

.
├── app.py
└── templates/
    └── index.html

Files

app.py

from flask import Flask, render_template
from flask_mde import Mde

app = Flask(__name__)
mde = Mde(app)

@app.route('/')
def index():
    return render_template(
        "index.html"
    )


if __name__ == "__main__":
    app.run()

templates/index.html

<!DOCTYPE html>
<html lang="en">
<head>
    {{mde.css}}
</head>
<body>
    {{mde.editor()}}
    {{mde.preview}}
    {{mde.js}}
</body>
</html>

Read the user guide to check out all the features.

Licenses that apply

  1. Flask-MDE License (MIT)
  2. Pagedown-Extra License
  3. Pagedown License

About

Markdown editor with WTForms integration for Flask

https://flask-mde.readthedocs.io

License:MIT License


Languages

Language:Python 78.8%Language:HTML 17.4%Language:CSS 3.9%