Author: Pedro Lucas Porcellis <pedrolucasporcellis@gmail.com>
Pass to mistune the raw text and show the preview
core/blueprints/basic.py | 5 ++++- core/templates/preview.html | 9 +++++++++
diff --git a/core/blueprints/basic.py b/core/blueprints/basic.py index 9d160f4fb475f876b622599d2f77cb8883464b92..4f6f100f5db0c4b7ea2fdc556643ae0667040796 100644 --- a/core/blueprints/basic.py +++ b/core/blueprints/basic.py @@ -1,4 +1,5 @@ from flask import Blueprint, render_template, request +import mistune basic = Blueprint('basic', __name__) @@ -10,4 +11,6 @@ else: return create(request.form) def create(params): - return params + rendered = mistune.markdown(params['text']) + + return render_template('preview.html', rendered = rendered) diff --git a/core/templates/preview.html b/core/templates/preview.html new file mode 100644 index 0000000000000000000000000000000000000000..afd06e0419fefe5dcfda25dbd4d595afde94a92d --- /dev/null +++ b/core/templates/preview.html @@ -0,0 +1,9 @@ +{% extends 'layout.html' %} + +{% block body %} + <div class="row"> + <div class="col-xs"> + {{ rendered | safe }} + </div> + </div> +{% endblock %}