diff options
author | ubq323 <ubq323> | 2021-06-14 14:33:36 +0000 |
---|---|---|
committer | ubq323 <ubq323> | 2021-06-14 14:33:36 +0000 |
commit | 9e505bc638e0eb7d40f0ce18afdfeb1077a98075 (patch) | |
tree | 639b554dfc6d3289278c72fcf4cc9fe0ea55814c /apioforum/thread.py | |
parent | ee2c781e132dbf97fb493eb1453af03f4beb2279 (diff) |
improve markdown rendering and html saniti(s/z)ation; enable strikethrough with tildes
Diffstat (limited to 'apioforum/thread.py')
-rw-r--r-- | apioforum/thread.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/apioforum/thread.py b/apioforum/thread.py index b9697ce..3378982 100644 --- a/apioforum/thread.py +++ b/apioforum/thread.py @@ -5,11 +5,7 @@ from flask import ( url_for, flash ) from .db import get_db - -def render_md(md): - from markdown import markdown - from markupsafe import escape - return markdown(escape(md)) +from .mdrender import render bp = Blueprint("thread", __name__, url_prefix="/thread") @@ -24,7 +20,7 @@ def view_thread(thread_id): "SELECT * FROM posts WHERE thread = ? ORDER BY created ASC;", (thread_id,) ).fetchall() - rendered_posts = [render_md(q['content']) for q in posts] + rendered_posts = [render(q['content']) for q in posts] return render_template("view_thread.html",posts=posts,thread=thread,thread_id=thread_id,rendered_posts=rendered_posts) @bp.route("/<int:thread_id>/create_post", methods=("POST",)) |