markdown: add markdown rendering
This commit is contained in:
parent
fd501587b5
commit
9409113167
|
@ -20,7 +20,7 @@
|
|||
</div>
|
||||
<div style="padding:30px;">
|
||||
<div style="font-size:115%;font-style:italic;margin-bottom:15px;">
|
||||
{{ member.signature }}
|
||||
{{ member.signature|md }}
|
||||
</div>
|
||||
<div>
|
||||
Membre depuis le {{ member.register_date|date('%Y-%m-%d') }}
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
<h2>Présentation</h2>
|
||||
<div>
|
||||
{{ member.bio }}
|
||||
{{ member.bio|md }}
|
||||
</div>
|
||||
|
||||
<h2>Groupes</h2>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<h1>{{ t.title }}</h1>
|
||||
<table class="thread"><tr>
|
||||
<td class="author">{{ widget_user.profile(t.author ) }}</td>
|
||||
<td>{{ t.thread.top_comment.text }}</td>
|
||||
<td>{{ t.thread.top_comment.text|md }}</td>
|
||||
</tr></table>
|
||||
|
||||
{{ widget_pagination.paginate(comments, 'forum_topic', t, {'f': t.forum}) }}
|
||||
|
@ -34,8 +34,9 @@
|
|||
| <a href="#">Supprimer</a>
|
||||
</div>
|
||||
<!--<hr>-->
|
||||
<p>{{ c.text }}</p>
|
||||
{{ c.text|md }}
|
||||
{{ widget_attachments.attachments(c) }}
|
||||
{{ c.author.signature|md }}
|
||||
{% elif loop.index0 != 0 %}
|
||||
<div>Ce message est le top comment</div>
|
||||
{% endif %}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Register filters here
|
||||
|
||||
from app.utils.filters import date, is_title, pluralize
|
||||
from app.utils.filters import date, is_title, markdown, pluralize
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
from app import app
|
||||
from markupsafe import Markup
|
||||
from markdown import markdown
|
||||
from werkzeug.utils import escape
|
||||
|
||||
@app.template_filter('md')
|
||||
def md(text):
|
||||
"""
|
||||
Converts markdown to html5
|
||||
"""
|
||||
# Escape html chars because markdown does not
|
||||
safe = escape(text)
|
||||
return Markup(markdown(safe))
|
Loading…
Reference in New Issue