Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Flask-SimpleMDE - a Flask extension for SimpleMDE

Project Description

Flask-SimpleMDE is an extension to Flask that helps integrate SimpleMDE Markdown Editor to your Flask application.

Quick Start

  1. Installation
pip install Flask-SimpleMDE
  1. 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)
  1. 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>
  1. Profit!

How It Works

Once registered, this extension provides a template variable called simplemde, it has:

  • a property named css that will be rendered as HTML <link> tag to the SimpleMDE stylesheet either from free CDN or be served from a bundled blueprint, also called simplemde.

    {{ simplemde.css }}
    
  • a property named js that will be rendered as HTML <script> tag to the SimpleMDE javascript either from free CDN or be served from a bundled blueprint, also called simplemde.

    {{ simplemde.js }}
    
  • a property named load that 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_id that 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 specified id attribute

    <textarea id="editor"></textarea>
    ...
    {{ simplemde.load_id("editor") }}
    

License

BSD New, see LICENSE for details.

Release History

Release History

This version
History Node

0.3.0

History Node

0.2

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
Flask-SimpleMDE-0.3.0.tar.gz (87.9 kB) Copy SHA256 Checksum SHA256 Source Mar 16, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting