mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
Fix indentation
This commit is contained in:
parent
80cbb73807
commit
ea0b086d5b
|
@ -40,13 +40,13 @@ def clean_link(link: str) -> str:
|
||||||
|
|
||||||
|
|
||||||
def sanitize_to_markdown(text: 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"""
|
"""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 = text.replace("\\", "\\\\").replace('//', '/\\/').replace("](", "]\\(") # replace escaping and links
|
||||||
text = re.sub(r"([`_*~:<>{}@|])", "\\\\\\1", text) # Escape common Markdown characters
|
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"^(#+ )", '\\\\\\1', text, 0, re.MULTILINE) # Escape headers
|
||||||
text = re.sub(r"^(\s*)- ", '\\1\\\\- ', text, 0, re.MULTILINE) # Escape lists
|
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
|
text = re.sub(r"^(\s*\d+)\. ", "\\1\\\\. ", text, 0, re.MULTILINE) # Escape numbered lists
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
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