add pyTelegramBotAPI
This commit is contained in:
@ -512,3 +512,21 @@ class StringUtils:
|
||||
大写首字母兼容None
|
||||
"""
|
||||
return s.title() if s else s
|
||||
|
||||
@staticmethod
|
||||
def escape_markdown(content: str) -> str:
|
||||
"""
|
||||
Escapes Markdown characters in a string of Markdown.
|
||||
|
||||
Credits to: simonsmh
|
||||
|
||||
:param content: The string of Markdown to escape.
|
||||
:type content: :obj:`str`
|
||||
|
||||
:return: The escaped string.
|
||||
:rtype: :obj:`str`
|
||||
"""
|
||||
|
||||
parses = re.sub(r"([_*\[\]()~`>#+\-=|.!{}])", r"\\\1", content)
|
||||
reparse = re.sub(r"\\\\([_*\[\]()~`>#+\-=|.!{}])", r"\1", parses)
|
||||
return reparse
|
||||
|
Reference in New Issue
Block a user