From a2a5d3fdd422b04486e803df11ef863d96cb8aa3 Mon Sep 17 00:00:00 2001 From: Francesco Filicetti Date: Thu, 28 Mar 2024 17:01:08 +0100 Subject: [PATCH] fix: tables in markdown --- uniticket/uni_ticket/settings.py | 5 +++++ uniticket/uni_ticket/templatetags/uni_ticket_tags.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/uniticket/uni_ticket/settings.py b/uniticket/uni_ticket/settings.py index 28c699cf..09494a19 100644 --- a/uniticket/uni_ticket/settings.py +++ b/uniticket/uni_ticket/settings.py @@ -515,3 +515,8 @@ PRECOMPILED_TICKET_EXPIRE_DAYS = getattr( settings, 'PRECOMPILED_TICKET_EXPIRE_DAYS', 7) +MARKDOWN_EXTENSIONS = getattr( + settings, "MARKDOWN_EXTENSIONS", + ["markdown.extensions.fenced_code", + "markdown.extensions.tables"] +) diff --git a/uniticket/uni_ticket/templatetags/uni_ticket_tags.py b/uniticket/uni_ticket/templatetags/uni_ticket_tags.py index 0f76c644..b248b30a 100644 --- a/uniticket/uni_ticket/templatetags/uni_ticket_tags.py +++ b/uniticket/uni_ticket/templatetags/uni_ticket_tags.py @@ -162,7 +162,7 @@ def obj_get_attr(obj, attr, **kwargs): @register.filter() @stringfilter def markdown(value): - return md.markdown(value, extensions=["markdown.extensions.fenced_code"]) + return md.markdown(value, extensions=uni_ticket_settings.MARKDOWN_EXTENSIONS) @register.simple_tag