mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-06 16:15:51 +00:00
Fix markdown spoiler (#1176)
* Fix spoiler * added a explanation * Updated the TestTextDecoration.test_apply_single_entity --------- Co-authored-by: = <=>
This commit is contained in:
parent
68a6c2c192
commit
c418689dc1
3 changed files with 3 additions and 2 deletions
1
CHANGES/1176.bugfix.rst
Normal file
1
CHANGES/1176.bugfix.rst
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fixed the markdown spoiler parser.
|
||||
|
|
@ -233,7 +233,7 @@ class MarkdownDecoration(TextDecoration):
|
|||
return f"~{value}~"
|
||||
|
||||
def spoiler(self, value: str) -> str:
|
||||
return f"|{value}|"
|
||||
return f"||{value}||"
|
||||
|
||||
def quote(self, value: str) -> str:
|
||||
return re.sub(pattern=self.MARKDOWN_QUOTE_PATTERN, repl=r"\\\1", string=value)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class TestTextDecoration:
|
|||
[markdown_decoration, MessageEntity(type="bot_command", offset=0, length=5), "test"],
|
||||
[markdown_decoration, MessageEntity(type="email", offset=0, length=5), "test"],
|
||||
[markdown_decoration, MessageEntity(type="phone_number", offset=0, length=5), "test"],
|
||||
[markdown_decoration, MessageEntity(type="spoiler", offset=0, length=5), "|test|"],
|
||||
[markdown_decoration, MessageEntity(type="spoiler", offset=0, length=5), "||test||"],
|
||||
[
|
||||
markdown_decoration,
|
||||
MessageEntity(type="custom_emoji", offset=0, length=5, custom_emoji_id="42"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue