summaryrefslogtreecommitdiff
path: root/strikethrough.py
blob: a3f8c508fe800a06d6a0fc2583baf79bed5332e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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]
)