Update markdown
This commit is contained in:
parent
2a0276d0fd
commit
8f95b070cd
2 changed files with 3 additions and 4 deletions
|
@ -17,6 +17,7 @@ EXTENSIONS = [
|
|||
"markdown.extensions.def_list",
|
||||
"markdown.extensions.tables",
|
||||
"markdown.extensions.admonition",
|
||||
"nl2br",
|
||||
]
|
||||
|
||||
ALLOWED_TAGS = bleach.sanitizer.ALLOWED_TAGS + [
|
||||
|
@ -52,10 +53,8 @@ ALLOWED_ATTRS = ["src", "width", "height", "href", "class"]
|
|||
|
||||
|
||||
@registry.filter
|
||||
def markdown(value, hard_wrap=False):
|
||||
def markdown(value):
|
||||
extensions = EXTENSIONS
|
||||
if hard_wrap:
|
||||
extensions = EXTENSIONS + ["nl2br"]
|
||||
html = _markdown.markdown(value, extensions=extensions)
|
||||
html = bleach.clean(html, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRS)
|
||||
if not html:
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
</a>
|
||||
{% endif %}
|
||||
<div class="message-text message-text-other">
|
||||
{{message.body|markdown(hard_wrap=True)|reference|str|safe }}
|
||||
{{message.body|markdown|reference|str|safe }}
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
|
|
Loading…
Reference in a new issue