fixed all markdown issues
This commit is contained in:
@@ -16,13 +16,13 @@ def contains_markdown_symbols(text):
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
if text.find("_") != -1 or text.find("*") != -1 or text.find("~") != -1 or text.find("`") != -1: # check if text contains markdown symbols
|
||||
if text.find("_") != -1 or text.find("*") != -1 or text.find("`") != -1: # check if text contains relevant markdown symbols
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def make_markdown_proof(text):
|
||||
def make_markdown_proof(text): # used to avoid errors related to markdown parsemode for telegram messaging
|
||||
""" makes text markdown proof
|
||||
:type text: string
|
||||
|
||||
@@ -37,11 +37,13 @@ def make_markdown_proof(text):
|
||||
|
||||
text = text.replace("_", "\\_")
|
||||
text = text.replace("*", "\\*")
|
||||
text = text.replace("~", "\\~")
|
||||
text = text.replace("`", "\\`")
|
||||
|
||||
return text
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("this is a module for helper functions for the bot and should not be run directly")
|
||||
print("this is a module for helper functions for the bot and should not be run directly")
|
||||
print(make_markdown_proof("_test_"))
|
||||
text = make_markdown_proof("_test_")
|
||||
print(f"{text}")
|
||||
Reference in New Issue
Block a user