Commit 7e068624 authored by Florian Münchbach's avatar Florian Münchbach
Browse files

[syntax_highlight] More strict checking for inline code spans

parent f2c4368f
......@@ -84,8 +84,14 @@ class ChatSyntaxHighlighter:
return matches
def find_inline_matches(self, text):
return [(i.start(), i.end(), for i in \
re.finditer(r'(?<!`)`(?!`|\n).+(?<!`)`', text)]
Inline code is highlighted if the start marker is precedded by a start
of line, a whitespace character or either of the other span markers
defined in XEP-0393.
The same applies mirrored to the end marker.
return [(i.start(1), i.end(1), for i in \
re.finditer(r'(?:^|\s|\*|~|_)(`((?!`).+?)`)(?:\s|\*|~|_|$)', text)]
def merge_match_groups(self, real_text, inline_matches, multiline_matches):
it_inline = iter(inline_matches)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment