Skip to main content
# Flask-SOEditor
A Stack Overflow editor extension for Flask.
## Installation
`pip install Flask-SOEditor`
## Usage
### Initialization
The first step is to initialize the extension:
```Python
from flask import Flask, render_template
from flask_soeditor import SOEditor

app = Flask(__name__)

soeditor = SOEditor(app)

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

if __name__ == '__main__':
app.run(debug=True)
```
Alternatively, you could use the `init_app()` method, like this:
```Python
from flask import Flask, render_template
from flask_soeditor import SOEditor

soeditor = SOEditor()

def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config_name])
config[config_name].init_app(app)

soeditor.init_app(app)
...
```

### Add editor in template
First, you have to load the css and js files, and then replace your textarea:
```Html
<!DOCTYPE html>
<html>
<head>
<title>Flask-SOEditor example</title>
{{ soeditor.css }}
{{ soeditor.js }}
</head>
<body>
<textarea id="mdeditor"></textarea>
<script type="text/javascript">
var soeditor = new SOEditor("textarea#mdeditor");
</script>
</body>
</html>
```

Release history Release notifications | RSS feed

This release

0.1.2 This release

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page