summaryrefslogtreecommitdiff
path: root/strikethrough.py
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-07-04 00:52:37 +0200
committerBotond Hende <nettingman@gmail.com>2024-07-15 23:34:41 +0200
commitd59cce6995025a8de220426187331c615ad3a4c7 (patch)
tree5cc105e6d94d7fa7b86229496800ec15055bec7d /strikethrough.py
initial commit, strikethrough
Diffstat (limited to 'strikethrough.py')
-rw-r--r--strikethrough.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/strikethrough.py b/strikethrough.py
new file mode 100644
index 0000000..a3f8c50
--- /dev/null
+++ b/strikethrough.py
@@ -0,0 +1,18 @@
+from marko import inline
+from marko.helpers import MarkoExtension
+
+
+class StrikeThrough(inline.InlineElement):
+ pattern = '~~(.+)~~'
+ parse_children = True
+
+
+class StrikeThroughRenderer:
+ def render_strike_through(self, element):
+ return f"<del>{self.render_children(element)}</del>"
+
+
+StrikeThrough = MarkoExtension(
+ elements=[StrikeThrough],
+ renderer_mixins=[StrikeThroughRenderer]
+)