sanitize_to_markdown

This commit is contained in:
MarkusRost 2021-05-01 21:27:30 +00:00
parent 20022a137d
commit 29a241d228

View file

@ -42,6 +42,7 @@ def clean_link(link: str) -> 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"""
return re.sub(r"([`_*~:<>{}@|\\])", "\\\\\\1", text, 0).replace('//', "/\\/").replace('](', "]\\(")
def sanitize_to_url(text: str) -> str: # TODO ) replaces needed?