Strikethrough support in markdown

This commit is contained in:
Lonami 2018-12-19 14:52:09 +00:00
parent 2c75fb25a3
commit facd436014
1 changed files with 5 additions and 0 deletions

View File

@ -44,6 +44,10 @@ def parse_aesthetics(m):
return "".join(aesthetify(m[1])), None return "".join(aesthetify(m[1])), None
def parse_strikethrough(m):
return ("\u0336".join(m[1]) + "\u0336"), None
def parse_subreddit(m): def parse_subreddit(m):
text = '/' + m.group(3) text = '/' + m.group(3)
entity = MessageEntityTextUrl( entity = MessageEntityTextUrl(
@ -78,6 +82,7 @@ MATCHERS = [
(get_tag_parser('```', partial(MessageEntityPre, language=''))), (get_tag_parser('```', partial(MessageEntityPre, language=''))),
(get_tag_parser('`', MessageEntityCode)), (get_tag_parser('`', MessageEntityCode)),
(re.compile(r'\+\+(.+?)\+\+'), parse_aesthetics), (re.compile(r'\+\+(.+?)\+\+'), parse_aesthetics),
(re.compile(r'~~(.+?)~~'), parse_strikethrough),
(re.compile(r'([^/\w]|^)(/?(r/\w+))'), parse_subreddit), (re.compile(r'([^/\w]|^)(/?(r/\w+))'), parse_subreddit),
(re.compile(r'(!\w+)'), parse_snip) (re.compile(r'(!\w+)'), parse_snip)
] ]