diff --git a/telebot/formatting.py b/telebot/formatting.py index 09687ec9f..24299b51a 100644 --- a/telebot/formatting.py +++ b/telebot/formatting.py @@ -323,7 +323,7 @@ def hide_link(url: str) -> str: return f'' -def mcite(content: str, escape: Optional[bool]=True) -> str: +def mcite(content: str, escape: Optional[bool] = True, expandable: Optional[bool] = False) -> str: """ Returns a Markdown-formatted block-quotation string. @@ -333,15 +333,20 @@ def mcite(content: str, escape: Optional[bool]=True) -> str: :param escape: True if you need to escape special characters. Defaults to True. :type escape: :obj:`bool` + :param expandable: True if you need the quote to be expandable. Defaults to False. + :type expandable: :obj:`bool` + :return: The formatted string. :rtype: :obj:`str` """ content = escape_markdown(content) if escape else content - content = '\n'.join(['>' + line for line in content.split('\n')]) + content = "\n".join([">" + line for line in content.split("\n")]) + if expandable: + return f"**{content}||" return content -def hcite(content: str, escape: Optional[bool]=True) -> str: +def hcite(content: str, escape: Optional[bool] = True, expandable: Optional[bool] = False) -> str: """ Returns a html-formatted block-quotation string. @@ -350,11 +355,17 @@ def hcite(content: str, escape: Optional[bool]=True) -> str: :param escape: True if you need to escape special characters. Defaults to True. :type escape: :obj:`bool` - + + :param expandable: True if you need the quote to be expandable. Defaults to False. + :type expandable: :obj:`bool` + :return: The formatted string. :rtype: :obj:`str` """ - return '
{}'.format(escape_html(content) if escape else content) + return "
{}".format( + " expandable" if expandable else "", + escape_html(content) if escape else content, + ) def apply_html_entities(text: str, entities: Optional[List], custom_subs: Optional[Dict[str, str]]) -> str: