diff options
-rw-r--r-- | __init__.py | 0 | ||||
-rw-r--r-- | strikethrough.py | 18 |
2 files changed, 18 insertions, 0 deletions
diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/__init__.py 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] +) |