"""
Encapsulates text in html tag, which usually displayed as strikethrough text.
Usage:
~~my text~~
"""
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]
)