diff --git a/utils/templatetags/commonmark.py b/utils/templatetags/commonmark.py index 6b885e61..7a35fa47 100644 --- a/utils/templatetags/commonmark.py +++ b/utils/templatetags/commonmark.py @@ -1,17 +1,16 @@ import CommonMark from django import template -from django.utils.encoding import force_text -from django.utils.safestring import mark_safe +from django.template.defaultfilters import stringfilter register = template.Library() -@register.filter(is_safe=True) +@register.filter +@stringfilter def commonmark(value): parser = CommonMark.Parser() renderer = CommonMark.HtmlRenderer() - ast = parser.parse(force_text(value)) - return mark_safe( - force_text(renderer.render(ast)) - ) \ No newline at end of file + ast = parser.parse(value) + return renderer.render(ast) + diff --git a/villages/templates/village_detail.html b/villages/templates/village_detail.html index 79925536..2768515f 100644 --- a/villages/templates/village_detail.html +++ b/villages/templates/village_detail.html @@ -9,7 +9,7 @@ Village: {{ village.name }} | {{ block.super }}