Skip to content
This repository was archived by the owner on Aug 28, 2019. It is now read-only.

Commit d9acc2f

Browse files
committed
Escape multi-line quotes properly
Fix Rapptz#5897
1 parent 62040de commit d9acc2f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

discord/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ def resolve_template(code):
482482

483483
_MARKDOWN_ESCAPE_COMMON = r'^>(?:>>)?\s|\[.+\]\(.+\)'
484484

485-
_MARKDOWN_ESCAPE_REGEX = re.compile(r'(?P<markdown>%s|%s)' % (_MARKDOWN_ESCAPE_SUBREGEX, _MARKDOWN_ESCAPE_COMMON))
485+
_MARKDOWN_ESCAPE_REGEX = re.compile(r'(?P<markdown>%s|%s)' % (_MARKDOWN_ESCAPE_SUBREGEX, _MARKDOWN_ESCAPE_COMMON), re.MULTILINE)
486486

487487
def escape_markdown(text, *, as_needed=False, ignore_links=True):
488488
r"""A helper function that escapes Discord's markdown.
@@ -521,7 +521,7 @@ def replacement(match):
521521
regex = r'(?P<markdown>[_\\~|\*`]|%s)' % _MARKDOWN_ESCAPE_COMMON
522522
if ignore_links:
523523
regex = '(?:%s|%s)' % (url_regex, regex)
524-
return re.sub(regex, replacement, text)
524+
return re.sub(regex, replacement, text, 0, re.MULTILINE)
525525
else:
526526
text = re.sub(r'\\', r'\\\\', text)
527527
return _MARKDOWN_ESCAPE_REGEX.sub(r'\\\1', text)

0 commit comments

Comments
 (0)