{
"info": {
"author": "TROUVERIE Joachim",
"author_email": "joachim.trouverie@linoame.fr",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Flask",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Utilities"
],
"description": "Flask-CodeMirror\n================\n\n|version| |license|\n\nImplementation of source code editor for Flask and Flask-WTF using CodeMirror Javascript library\n\nInstallation\n------------\n\n $ pip install flask-codemirror\n\nExample\n-------\nA simple example of how to use this module\n\n .. code:: python\n\n from flask_wtf import FlaskForm\n from flask_codemirror.fields import CodeMirrorField\n from wtforms.fields import SubmitField\n\n class MyForm(FlaskForm):\n source_code = CodeMirrorField(language='python', config={'lineNumbers': 'true'})\n submit = SubmitField('Submit')\n\nThe `CodeMirrorField` works exactly like a `TextAreaField`\n\n .. code:: python\n\n @app.route('/', methods = ['GET', 'POST'])\n def index():\n form = MyForm()\n if form.validate_on_submit():\n text = form.source_code.data\n return render_template('index.html', form=form)\n\nThe module needs to be initialized in the usual way and can be configured using app.config keys\n\n .. code:: python\n\n from flask import Flask\n from flask_codemirror import CodeMirror\n # mandatory\n CODEMIRROR_LANGUAGES = ['python', 'html']\n WTF_CSRF_ENABLED = True\n SECRET_KEY = 'secret'\n # optional\n CODEMIRROR_THEME = '3024-day'\n CODEMIRROR_ADDONS = (\n ('ADDON_DIR','ADDON_NAME'),\n )\n app = Flask(__name__)\n app.config.from_object(__name__)\n codemirror = CodeMirror(app)\n\nThe config `CODEMIRROR_LANGUAGES` needs to be initialized to load JavaScript. It defined all the languages you want to edit with your fields.\nThe config `CODEMIRROR_THEME` is optional and is used to style your TextArea using css from `CodeMirror website