Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ins_tag = SimpleTagPattern(INS_RE, 'ins')
md.inlinePatterns.add('ins', ins_tag, '>del')
# "Quote" converts to <q>Quote</q>
q_tag = SimpleTagPattern(Q_RE, 'q')
md.inlinePatterns.add('q', q_tag, '>ins')
# ==Mark== converts to <mark>..</mark>
mark_tag = SimpleTagPattern(MARK_RE, 'mark')
md.inlinePatterns.add('mark', mark_tag, '>q')
# _Underline_ converts to <u>Underline</u>
u_tag = SimpleTagPattern(U_RE, 'u')
md.inlinePatterns.add('ins', u_tag, '>mark')
# ^Sup converts to <sup>Sup</sup>
sup_tag = SimpleTagPattern(SUP_RE, 'sup')
md.inlinePatterns.add('sup', sup_tag, '>ins')
# !!Sub converts to <sub>Sub</sub>
sub_tag = SimpleTagPattern(SUB_RE, 'sub')
md.inlinePatterns.add('sub', sub_tag, '>sup')
# [[Dropcap]] converts to <span class="dropcap">>Sub</span>
dropcap_tag = SimpleTagPattern(DROPCAP_RE, 'dropcap')
md.inlinePatterns.add('dropcap', dropcap_tag, '>sub')
strong_tag = SimpleTagPattern(STRONG_RE, 'strong')
md.inlinePatterns['strong'] = strong_tag
em_tag = SimpleTagPattern(EM_RE, 'em')
md.inlinePatterns['em'] = em_tag
emph_tag = SimpleTagPattern(EMPH_RE, 'emphasis')
md.inlinePatterns['emphasis'] = emph_tag
del md.inlinePatterns['strong_em']
del md.inlinePatterns['em_strong']
under_strong_em2 = SMART_UNDER_STRONG_EM2 if enable_under else UNDER_STRONG_EM2
star_strong = SMART_STAR_STRONG if enable_star else STAR_STRONG
under_strong = SMART_UNDER_STRONG if enable_under else UNDER_STRONG
star_emphasis = SMART_STAR_EM if enable_star else STAR_EM
under_emphasis = SMART_UNDER_EM if enable_under else UNDER_EM
md.inlinePatterns["strong_em"] = DoubleTagPattern(star_strong_em, 'strong,em')
md.inlinePatterns.add("strong_em2", DoubleTagPattern(under_strong_em, 'strong,em'), '>strong_em')
md.inlinePatterns.link("em_strong", ">strong_em2")
md.inlinePatterns["em_strong"] = DoubleTagPattern(star_em_strong, 'em,strong')
md.inlinePatterns.add('em_strong2', DoubleTagPattern(under_em_strong, 'em,strong'), '>em_strong')
md.inlinePatterns.add('strong_em3', DoubleTagPattern(star_strong_em2, 'strong,em'), '>em_strong2')
md.inlinePatterns.add('strong_em4', DoubleTagPattern(under_strong_em2, 'strong,em'), '>strong_em3')
md.inlinePatterns["strong"] = SimpleTagPattern(star_strong, 'strong')
md.inlinePatterns.add("strong2", SimpleTagPattern(under_strong, 'strong'), '>strong')
md.inlinePatterns["emphasis"] = SimpleTagPattern(star_emphasis, 'em')
md.inlinePatterns["emphasis2"] = SimpleTagPattern(under_emphasis, 'em')
star_strong = SMART_STAR_STRONG if enable_star else STAR_STRONG
under_strong = SMART_UNDER_STRONG if enable_under else UNDER_STRONG
star_emphasis = SMART_STAR_EM if enable_star else STAR_EM
under_emphasis = SMART_UNDER_EM if enable_under else UNDER_EM
md.inlinePatterns["strong_em"] = DoubleTagPattern(star_strong_em, 'strong,em')
md.inlinePatterns.add("strong_em2", DoubleTagPattern(under_strong_em, 'strong,em'), '>strong_em')
md.inlinePatterns.link("em_strong", ">strong_em2")
md.inlinePatterns["em_strong"] = DoubleTagPattern(star_em_strong, 'em,strong')
md.inlinePatterns.add('em_strong2', DoubleTagPattern(under_em_strong, 'em,strong'), '>em_strong')
md.inlinePatterns.add('strong_em3', DoubleTagPattern(star_strong_em2, 'strong,em'), '>em_strong2')
md.inlinePatterns.add('strong_em4', DoubleTagPattern(under_strong_em2, 'strong,em'), '>strong_em3')
md.inlinePatterns["strong"] = SimpleTagPattern(star_strong, 'strong')
md.inlinePatterns.add("strong2", SimpleTagPattern(under_strong, 'strong'), '>strong')
md.inlinePatterns["emphasis"] = SimpleTagPattern(star_emphasis, 'em')
md.inlinePatterns["emphasis2"] = SimpleTagPattern(under_emphasis, 'em')
def extendMarkdown(self, md, md_globals):
highlight_pattern = SimpleTagPattern(self.HIGHLIGHT_RE, 'mark')
md.inlinePatterns.add('highlight', highlight_pattern, '_end')
pdf_pattern = PDFPattern(self.PDF_RE)
md.inlinePatterns.add('pdf_link', pdf_pattern, '_begin')
md.inlinePatterns.add('q', q_tag, '>ins')
# ==Mark== converts to <mark>..</mark>
mark_tag = SimpleTagPattern(MARK_RE, 'mark')
md.inlinePatterns.add('mark', mark_tag, '>q')
# _Underline_ converts to <u>Underline</u>
u_tag = SimpleTagPattern(U_RE, 'u')
md.inlinePatterns.add('ins', u_tag, '>mark')
# ^Sup converts to <sup>Sup</sup>
sup_tag = SimpleTagPattern(SUP_RE, 'sup')
md.inlinePatterns.add('sup', sup_tag, '>ins')
# !!Sub converts to <sub>Sub</sub>
sub_tag = SimpleTagPattern(SUB_RE, 'sub')
md.inlinePatterns.add('sub', sub_tag, '>sup')
# [[Dropcap]] converts to <span class="dropcap">>Sub</span>
dropcap_tag = SimpleTagPattern(DROPCAP_RE, 'dropcap')
md.inlinePatterns.add('dropcap', dropcap_tag, '>sub')
strong_tag = SimpleTagPattern(STRONG_RE, 'strong')
md.inlinePatterns['strong'] = strong_tag
em_tag = SimpleTagPattern(EM_RE, 'em')
md.inlinePatterns['em'] = em_tag
emph_tag = SimpleTagPattern(EMPH_RE, 'emphasis')
md.inlinePatterns['emphasis'] = emph_tag
del md.inlinePatterns['strong_em']
del md.inlinePatterns['em_strong']
del md.inlinePatterns['emphasis2']
def extendMarkdown(self, md, md_globals):
pattern = SimpleTagPattern(STRIKE_RE, 'del')
md.inlinePatterns.add('gfm-strikethrough', pattern, '_end')
def extendMarkdown(self, md, md_globals):
"""Modifies inline patterns."""
md.inlinePatterns.add('del', SimpleTagPattern(DEL_RE, 'del'), '
def extendMarkdown(self, md, md_globals):
# Create the del pattern
del_tag = markdown.inlinepatterns.SimpleTagPattern(
self.DEL_RE, 'del')
# Insert del pattern into markdown parser
md.inlinePatterns.add('del', del_tag, '>not_strong')
reg.register(UserMentionPattern(mention.find_mentions, self), 'usermention', 95)
reg.register(Tex(r'\B(?[^\n_$](\\\$|[^$\n])*)\$\$(?!\$)\B'), 'tex', 90)
reg.register(StreamTopicPattern(get_compiled_stream_topic_link_regex(), self), 'topic', 87)
reg.register(StreamPattern(get_compiled_stream_link_regex(), self), 'stream', 85)
reg.register(Avatar(AVATAR_REGEX, self), 'avatar', 80)
reg.register(ModalLink(r'!modal_link\((?P[^)]*), (?P
def extendMarkdown(self, md, md_globals):
# *[[Caption]]* converts to Caption
caption_tag = SimpleTagPattern(CAPTION_RE, 'caption')
md.inlinePatterns.add('caption', caption_tag, '>not_strong')
# ~~Delete~~ converts to <del>Delete</del>
del_tag = SimpleTagPattern(DEL_RE, 'del')
md.inlinePatterns.add('del', del_tag, '>caption')
# __Insert__ converts to <ins>Insert</ins>
ins_tag = SimpleTagPattern(INS_RE, 'ins')
md.inlinePatterns.add('ins', ins_tag, '>del')
# "Quote" converts to <q>Quote</q>
q_tag = SimpleTagPattern(Q_RE, 'q')
md.inlinePatterns.add('q', q_tag, '>ins')
# ==Mark== converts to <mark>..</mark>
mark_tag = SimpleTagPattern(MARK_RE, 'mark')
md.inlinePatterns.add('mark', mark_tag, '>q')
# _Underline_ converts to <u>Underline</u>
u_tag = SimpleTagPattern(U_RE, 'u')
md.inlinePatterns.add('ins', u_tag, '>mark')
# ^Sup converts to <sup>Sup</sup>
sup_tag = SimpleTagPattern(SUP_RE, 'sup')
md.inlinePatterns.add('sup', sup_tag, '>ins')
# !!Sub converts to <sub>Sub</sub>
sub_tag = SimpleTagPattern(SUB_RE, 'sub')
md.inlinePatterns.add('sub', sub_tag, '>sup')