From ea0b086d5beb4b81006ec9b38a898ab8ee308d33 Mon Sep 17 00:00:00 2001 From: Frisk Date: Fri, 27 Sep 2024 14:01:14 +0200 Subject: [PATCH] Fix indentation --- src/api/util.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/api/util.py b/src/api/util.py index 85d553f..2acdebd 100644 --- a/src/api/util.py +++ b/src/api/util.py @@ -40,13 +40,13 @@ 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""" - text = text.replace("\\", "\\\\").replace('//', '/\\/').replace("](", "]\\(") # replace escaping and links - text = re.sub(r"([`_*~:<>{}@|])", "\\\\\\1", text) # Escape common Markdown characters - text = re.sub(r"^(#+ )", '\\\\\\1', text, 0, re.MULTILINE) # Escape headers - text = re.sub(r"^(\s*)- ", '\\1\\\\- ', text, 0, re.MULTILINE) # Escape lists - text = re.sub(r"^(\s*\d+)\. ", "\\1\\\\. ", text, 0, re.MULTILINE) # Escape numbered lists - return text + """Sanitizes given text to escape markdown formatting. It is used in values that will be visible on Discord in messages""" + text = text.replace("\\", "\\\\").replace('//', '/\\/').replace("](", "]\\(") # replace escaping and links + text = re.sub(r"([`_*~:<>{}@|])", "\\\\\\1", text) # Escape common Markdown characters + text = re.sub(r"^(#+ )", '\\\\\\1', text, 0, re.MULTILINE) # Escape headers + text = re.sub(r"^(\s*)- ", '\\1\\\\- ', text, 0, re.MULTILINE) # Escape lists + text = re.sub(r"^(\s*\d+)\. ", "\\1\\\\. ", text, 0, re.MULTILINE) # Escape numbered lists + return text def sanitize_to_url(text: str) -> str: # TODO ) replaces needed?