Update markdown

This commit is contained in:
cuom1999 2022-10-25 18:10:33 -05:00
parent 2a0276d0fd
commit 8f95b070cd
2 changed files with 3 additions and 4 deletions

View file

@ -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:

View file

@ -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>