fix(gateway): support Telegram MarkdownV2 expandable blockquotes

This commit is contained in:
Zhuofeng Wang 2026-04-11 06:52:42 +00:00 committed by Teknium
parent 70611879de
commit 449c17e9a9
2 changed files with 34 additions and 2 deletions

View file

@ -408,6 +408,27 @@ class TestFormatMessageBlockquote:
result = adapter.format_message("5 > 3")
assert "\\>" in result
def test_expandable_blockquote(self, adapter):
"""Expandable blockquote prefix **> and trailing || must NOT be escaped."""
result = adapter.format_message("**> Hidden content||")
assert "**>" in result
assert "||" in result
assert "\\*" not in result # asterisks in prefix must not be escaped
assert "\\>" not in result # > in prefix must not be escaped
def test_single_asterisk_gt_not_blockquote(self, adapter):
"""Single asterisk before > should not be treated as blockquote prefix."""
result = adapter.format_message("*> not a quote")
assert "\\*" in result
assert "\\>" in result
def test_regular_blockquote_with_pipes_escaped(self, adapter):
"""Regular blockquote ending with || should escape the pipes."""
result = adapter.format_message("> not expandable||")
assert "> not expandable" in result
assert "\\|" in result
assert "\\>" not in result
# =========================================================================
# format_message - mixed/complex