diff options
author | Botond Hende <nettingman@gmail.com> | 2024-07-04 00:52:37 +0200 |
---|---|---|
committer | Botond Hende <nettingman@gmail.com> | 2024-07-15 23:34:41 +0200 |
commit | d59cce6995025a8de220426187331c615ad3a4c7 (patch) | |
tree | 5cc105e6d94d7fa7b86229496800ec15055bec7d |
initial commit, strikethrough
-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] +) |