"""
Encapsulates text in html tag, which usually displayed as strikethrough text.
Usage:
~~my text~~
"""
from marko import inline
from marko.helpers import MarkoExtension
class StrikeThroughElement(inline.InlineElement):
pattern = '~~(.+)~~'
parse_children = True
class StrikeThroughRenderer:
def render_strike_through_element(self, element):
return f"{self.render_children(element)}"
StrikeThrough = MarkoExtension(
elements=[StrikeThroughElement],
renderer_mixins=[StrikeThroughRenderer]
)