diff --git a/opentech/apply/activity/templates/activity/include/listing_base.html b/opentech/apply/activity/templates/activity/include/listing_base.html index 3178eca2083b2eb1b51ac957ca1f549a7f3f626f..a9eb4e27a542552a137a3b14d4fcb97305c556da 100644 --- a/opentech/apply/activity/templates/activity/include/listing_base.html +++ b/opentech/apply/activity/templates/activity/include/listing_base.html @@ -30,7 +30,7 @@ updated <a href="{{ activity.submission.get_absolute_url }}">{{ activity.submission.title }}</a> {% endif %} - <div class="feed__comment js-comment" data-id="{{activity.id}}" data-comment="{{activity.message}}"> + <div class="feed__comment js-comment" data-id="{{activity.id}}" data-comment="{{activity.message|to_markdown}}"> {{ activity|display_for:request.user|submission_links|markdown|bleach }} </div> diff --git a/opentech/apply/funds/templatetags/markdown_tags.py b/opentech/apply/funds/templatetags/markdown_tags.py index 9ba5ff19dc0828092dcfab40fdcd9ab6876f7b58..a4e76e648ea66b7e1a3e6a788cc81c5be922b726 100644 --- a/opentech/apply/funds/templatetags/markdown_tags.py +++ b/opentech/apply/funds/templatetags/markdown_tags.py @@ -1,11 +1,16 @@ import mistune +import tomd from django import template register = template.Library() +mistune_markdown = mistune.Markdown() @register.filter def markdown(value): - markdown = mistune.Markdown() - return markdown(value) + return mistune_markdown(value) + +@register.filter +def to_markdown(value): + return tomd.convert(value) diff --git a/requirements.txt b/requirements.txt index 192f6e09ab86362a00dc1f4f7af179e3984463c3..ec3bc53376c6f238efb19d9ffea89edd0134b4e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -43,6 +43,7 @@ mistune==0.8.4 Pillow==4.3.0 psycopg2==2.7.3.1 social_auth_app_django==3.1.0 +tomd==0.1.3 wagtail~=2.2.0 wagtail-cache==0.5.1 whitenoise==4.0