mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
sanitize_to_markdown
This commit is contained in:
parent
20022a137d
commit
29a241d228
|
@ -42,6 +42,7 @@ def clean_link(link: str) -> str:
|
||||||
|
|
||||||
def sanitize_to_markdown(text: str):
|
def sanitize_to_markdown(text: str):
|
||||||
"""Sanitizes given text to escape markdown formatting. It is used in values that will be visible on Discord in messages"""
|
"""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, 0).replace('//', "/\\/").replace('](', "]\\(")
|
||||||
|
|
||||||
|
|
||||||
def sanitize_to_url(text: str) -> str: # TODO ) replaces needed?
|
def sanitize_to_url(text: str) -> str: # TODO ) replaces needed?
|
||||||
|
|
Loading…
Reference in a new issue