Commit 908ee5e4 authored by Florian Münchbach's avatar Florian Münchbach

[syntax_highlight] More strict checking for multi-line code blocks

parent e419bfc1
......@@ -71,7 +71,8 @@ class ChatSyntaxHighlighter:
def find_multiline_matches(self, text):
start = None
matches = []
for i in re.finditer(r'\n?```(?:\S*\n)?', text, re.DOTALL):
#Less strict, allow prefixed whitespaces: for i in re.finditer(r'(?:^|\n)[ |\t]*(```)\S*[ |\t]*(?:\n|$)', text, re.DOTALL):
for i in re.finditer(r'(?:^|\n)(```)\S*(?:\n|$)', text, re.DOTALL):
if start is None:
start = i
elif re.match(r'^\n```', i.group(0)) is not None:
......
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