From 077db58de0dddbf18865ecec6a50d47ca741e0e6 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sun, 12 Feb 2023 18:16:58 +0100 Subject: [PATCH] allow markdown in message of the day --- cookbook/templates/base.html | 4 ++-- cookbook/templatetags/custom_tags.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbook/templates/base.html b/cookbook/templates/base.html index ee60fa807..7036ef40a 100644 --- a/cookbook/templates/base.html +++ b/cookbook/templates/base.html @@ -350,8 +350,8 @@ {% message_of_the_day request as message_of_the_day %} {% if message_of_the_day %} -
- {{ message_of_the_day }} +
+ {{ message_of_the_day | markdown |safe }}
{% endif %} diff --git a/cookbook/templatetags/custom_tags.py b/cookbook/templatetags/custom_tags.py index 03c6701aa..b958999a5 100644 --- a/cookbook/templatetags/custom_tags.py +++ b/cookbook/templatetags/custom_tags.py @@ -57,6 +57,8 @@ def markdown(value): ] ) markdown_attrs['*'] = markdown_attrs['*'] + ['class'] + parsed_md = parsed_md[3:] # remove outer paragraph + parsed_md = parsed_md[:len(parsed_md)-4] return bleach.clean(parsed_md, tags, markdown_attrs)