diff --git a/discord/utils.py b/discord/utils.py index f4dee3ff7..a396b5615 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -1021,13 +1021,13 @@ def resolve_gift(code: Union[Gift, str]) -> str: _MARKDOWN_ESCAPE_SUBREGEX = '|'.join(r'\{0}(?=([\s\S]*((?(?:>>)?\s|\[.+\]\(.+\)' +_MARKDOWN_ESCAPE_COMMON = r'^>(?:>>)?\s|\[.+\]\(.+\)|^#{1,3}|^\s*-' _MARKDOWN_ESCAPE_REGEX = re.compile(fr'(?P{_MARKDOWN_ESCAPE_SUBREGEX}|{_MARKDOWN_ESCAPE_COMMON})', re.MULTILINE) _URL_REGEX = r'(?P<[^: >]+:\/[^ >]+>|(?:https?|steam):\/\/[^\s<]+[^<.,:;\"\'\]\s])' -_MARKDOWN_STOCK_REGEX = fr'(?P[_\\~|\*`#-]|{_MARKDOWN_ESCAPE_COMMON})' +_MARKDOWN_STOCK_REGEX = fr'(?P[_\\~|\*`]|{_MARKDOWN_ESCAPE_COMMON})' def remove_markdown(text: str, *, ignore_links: bool = True) -> str: @@ -1054,7 +1054,7 @@ def remove_markdown(text: str, *, ignore_links: bool = True) -> str: The text with the markdown special characters removed. """ - def replacement(match): + def replacement(match: re.Match[str]) -> str: groupdict = match.groupdict() return groupdict.get('url', '')