mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 08:56:10 +00:00
Make fence regex stricter to only match fence-like things
(imported from commit 59d5302b7af09c669423d364d46fb0d1b6a7b080)
This commit is contained in:
@@ -68,7 +68,7 @@ import markdown
|
|||||||
from zephyr.lib.bugdown.codehilite import CodeHilite, CodeHiliteExtension
|
from zephyr.lib.bugdown.codehilite import CodeHilite, CodeHiliteExtension
|
||||||
|
|
||||||
# Global vars
|
# Global vars
|
||||||
FENCE_RE = re.compile(r'(?P<fence>^(?:~{3,}))[ ]*(\{?\.?(?P<lang>[a-zA-Z0-9_+-]*)\}?)', re.MULTILINE|re.DOTALL)
|
FENCE_RE = re.compile(r'(?P<fence>^(?:~{3,}))[ ]*(\{?\.?(?P<lang>[a-zA-Z0-9_+-]*)\}?)$', re.MULTILINE|re.DOTALL)
|
||||||
FENCED_BLOCK_RE = re.compile( \
|
FENCED_BLOCK_RE = re.compile( \
|
||||||
r'(?P<fence>^(?:~{3,}))[ ]*(\{?\.?(?P<lang>[a-zA-Z0-9_+-]*)\}?)?[ ]*\n(?P<code>.*?)(?<=\n)(?P=fence)[ ]*$',
|
r'(?P<fence>^(?:~{3,}))[ ]*(\{?\.?(?P<lang>[a-zA-Z0-9_+-]*)\}?)?[ ]*\n(?P<code>.*?)(?<=\n)(?P=fence)[ ]*$',
|
||||||
re.MULTILINE|re.DOTALL
|
re.MULTILINE|re.DOTALL
|
||||||
|
|||||||
Reference in New Issue
Block a user