From d59cce6995025a8de220426187331c615ad3a4c7 Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Thu, 4 Jul 2024 00:52:37 +0200 Subject: initial commit, strikethrough --- __init__.py | 0 strikethrough.py | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 __init__.py create mode 100644 strikethrough.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 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"{self.render_children(element)}" + + +StrikeThrough = MarkoExtension( + elements=[StrikeThrough], + renderer_mixins=[StrikeThroughRenderer] +) -- cgit v1.2.3-70-g09d2