fixed errors

This commit is contained in:
Linus E
2022-05-10 18:43:41 +02:00
parent a3172cc9c5
commit 9324573cde
3 changed files with 33 additions and 12 deletions

View File

@@ -6,7 +6,7 @@ __date__ = "10.05.2022"
__version__ = "1.0.0"
__license__ = "None"
def contains_markdown_symbols(text):
def contains_markdownv1_symbols(text):
""" checks if text contains markdown symbols
:type text: string
@@ -32,12 +32,30 @@ def make_markdown_proof(text): # used to avoid errors related to markdown parsem
:rtype: string
"""
if not contains_markdown_symbols(text):
return text
text = text.replace("_", "\\_")
text = text.replace("*", "\\*")
text = text.replace("`", "\\`")
text = text.replace("[", "\\[")
text = text.replace("]", "\\]")
text = text.replace("(", "\\(")
text = text.replace(")", "\\)")
text = text.replace("#", "\\#")
text = text.replace("+", "\\+")
text = text.replace("-", "\\-")
text = text.replace("!", "\\!")
text = text.replace(".", "\\.")
text = text.replace("?", "\\?")
text = text.replace("/", "\\/")
text = text.replace("~", "\\~")
text = text.replace("|", "\\|")
text = text.replace("<", "\\<")
text = text.replace(">", "\\>")
text = text.replace("&", "\\&")
text = text.replace("^", "\\^")
text = text.replace("$", "\\$")
text = text.replace("%", "\\%")
return text