diff options
Diffstat (limited to 'strikethrough.py')
-rw-r--r-- | strikethrough.py | 18 |
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] +) |