Incorrect Markdown Order for Bold Hyperlinks
Code that causes the issue
message_entity = telegram_client.get_messages('TelethonChat', ids=[661069])
print(message_entity[0].text)
Expected behavior
I'm currently using telethon.extensions.markdown.unparse() to reconstruct messages from text and entities. However, I noticed an issue when dealing with messages that include both bold and hyperlinks.
When the original message contains a bold hyperlink, the unparse() method generates:
[**Bold Link**](https://example.com)
Expected behavior is:
**[Bold Link](https://example.com)**
Telethon version
1.34
Python version
3.12
Operating system (including distribution name and version)
Windows 11
Other details
No response
Checklist
- [x] The error is in the library's code, and not in my own.
- [x] I have searched for this issue before posting it and there isn't an open duplicate.
- [x] I ran
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zipand triggered the bug in the latest version.
Does it work if you unparse(*parse('**[Bold Link](https://example.com)**'))?
When I get a message entity by id, the text property returned from the hyperlink in bold is [**text**](url), but for the sending to work I must follow the pattern **[text](url)**
See the example with message: https://t.me/TelethonChat/661069
If the answer to my question is "yes, it works", then the problem is on Telegram (it puts the link before the bold). If the answer is "no", then it might be an issue in the library.