diff --git a/tjdests/apps/destinations/templatetags/markdown.py b/tjdests/apps/destinations/templatetags/markdown.py index e3c52be..c6ae66f 100644 --- a/tjdests/apps/destinations/templatetags/markdown.py +++ b/tjdests/apps/destinations/templatetags/markdown.py @@ -2,10 +2,14 @@ from markdown import markdown from django import template +from .strikethrough import StrikethroughExtension + register = template.Library() @register.filter(name="markdown") def convert_markdown(text: str): """Convert text to markdown HTML.""" - return markdown(text, extensions=["extra", "codehilite", "smarty"]) + return markdown( + text, extensions=["extra", "codehilite", "smarty", StrikethroughExtension()] + ) diff --git a/tjdests/apps/destinations/templatetags/sanitize.py b/tjdests/apps/destinations/templatetags/sanitize.py index 6a13e14..e04f277 100644 --- a/tjdests/apps/destinations/templatetags/sanitize.py +++ b/tjdests/apps/destinations/templatetags/sanitize.py @@ -5,7 +5,11 @@ from django import template register = template.Library() -tags = ALLOWED_TAGS + ["h" + str(i) for i in range(1, 7)] + ["div", "p", "pre", "span"] +tags = ( + ALLOWED_TAGS + + ["h" + str(i) for i in range(1, 7)] + + ["div", "p", "pre", "span", "s"] +) attrs = {"*": ["class"]} diff --git a/tjdests/apps/destinations/templatetags/strikethrough.py b/tjdests/apps/destinations/templatetags/strikethrough.py new file mode 100644 index 0000000..ab1df5f --- /dev/null +++ b/tjdests/apps/destinations/templatetags/strikethrough.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# pylint: skip-file +"""Markdown Strikethrough Extension +Extends the Python-Markdown library to support strikethrough text. +Given the text: + The molecular composition of water is ~~HCl~~. +Will output: +
The molecular composition of water is HCl.