pyx / flask-simplemde

Flask-SimpleMDE - a Flask extension for SimpleMDE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flask-SimpleMDE - a Flask extension for SimpleMDE

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

Quick Start

  1. Installation
  1. Configuration
  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.

About

Flask-SimpleMDE - a Flask extension for SimpleMDE

License:Other


Languages

Language:Python 80.8%Language:Makefile 19.2%