mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-22 00:14:10 +00:00
Merge remote-tracking branch 'origin/markdown-update' into testing
This commit is contained in:
commit
9964dbc363
|
@ -42,7 +42,7 @@ def clean_link(link: str) -> str:
|
|||
|
||||
def sanitize_to_markdown(text: str) -> str:
|
||||
"""Sanitizes given text to escape markdown formatting. It is used in values that will be visible on Discord in messages"""
|
||||
return re.sub(r"([`_*~:<>{}@|\\])", "\\\\\\1", text).replace('//', "/\\/").replace('](', "]\\(")
|
||||
return re.sub(r"([`_*~:<>{}@|#\-\.\\])", "\\\\\\1", text).replace('//', "/\\/").replace('](', "]\\(")
|
||||
|
||||
|
||||
def sanitize_to_url(text: str) -> str: # TODO ) replaces needed?
|
||||
|
|
|
@ -173,7 +173,7 @@ class ContentParser(HTMLParser):
|
|||
def handle_data(self, data):
|
||||
def escape_formatting(data: str) -> str:
|
||||
"""Escape Discord formatting"""
|
||||
return re.sub(r"([`_*~<>{}@/|\\])", "\\\\\\1", data)
|
||||
return re.sub(r"([`_*~:<>{}@/|#\-\.\\\[\]\(\)])", "\\\\\\1", data)
|
||||
data = escape_formatting(data)
|
||||
if self.current_tag == "ins" and self.ins_length <= 1000:
|
||||
self.ins_length += len("**" + data + "**")
|
||||
|
|
Loading…
Reference in a new issue