Flask-SimpleMDE is an extension to Flask that helps integrate SimpleMDE Markdown Editor to your Flask application.
Quick Start
Installation
pip install Flask-SimpleMDE
Configuration
from flask import Flask, render_template from flask.ext.simplemde import SimpleMDE app = Flask(__name__) app.config['SIMPLEMDE_JS_IIFE'] = True app.config['SIMPLEMDE_USE_CDN'] = True SimpleMDE(app) @app.route('/') def hello(): return render_template('hello.html') if __name__ == '__main__': app.run(debug=True)
In
templates/hello.html:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Flask-SimpleMDE example</title> {{ simplemde.css }} {{ simplemde.js }} </head> <body> <textarea> Some Markdown Text Here </textarea> {{ simplemde.load }} </body> </html>
Profit!
How It Works
Once registered, this extension provides a template variable called
simplemde, it has:
a property named
cssthat will be rendered as HTML<link>tag to the SimpleMDE stylesheet either from free CDN or be served from a bundled blueprint, also calledsimplemde.{{ simplemde.css }}a property named
jsthat will be rendered as HTML<script>tag to the SimpleMDE javascript either from free CDN or be served from a bundled blueprint, also calledsimplemde.{{ simplemde.js }}a property named
loadthat will be rendered as HTML<script>tag with javascript code that loads the SimpleMDE Markdown Editor with the first<textarea>tag.{{ simplemde.load }}a method named
load_idthat when called with a string, will be rendered as HTML<script>tag with javascript code that loads the SimpleMDE Markdown Editor with the<textarea>tag which has the specifiedidattribute<textarea id="editor"></textarea> ... {{ simplemde.load_id("editor") }}
License
BSD New, see LICENSE for details.
Links
Metadata
Release files for Flask-SimpleMDE 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Flask-SimpleMDE-0.3.0.tar.gz | 87.9 kB | Details |
Release files / Flask-SimpleMDE-0.3.0.tar.gz
| Download URL | Flask-SimpleMDE-0.3.0.tar.gz |
|---|---|
| Size | 87.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b27daf6421b8d1973aea1538e831a92b869d8f9e08ffde039d041dad61aa10b
|
|
BLAKE2b-256 checksum How to use checksums |
0c3fe4f3b75d44714035495466456b5315f7b7bdee3aa2a2981d9ed888e08d4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |