I’m creating a Telegram bot using Python and having trouble with text formatting using markdown. The documentation isn’t clear about how markdown works in Telegram bots.
There are two different markdown modes available (Markdown and MarkdownV2) but neither one formats text the same way as when you type manually in a regular Telegram chat.
Here’s what I’m testing:
message_text = "*Bold text*, _italic text_, *_combined bold italic_*, **strong bold**, __strong italic__, __**all formatting combined**__"
bot.send_message(chat_id=user_id, text=message_text, parse_mode="Markdown")
With parse_mode="Markdown" I get: Bold text, italic text, combined bold italic, but double asterisks and underscores don’t work.
With parse_mode="MarkdownV2" I get: Bold text, italic text, combined bold italic, but still issues with double formatting.
In regular chat typing, the same string shows completely different results.
Can someone explain how to properly combine bold and italic formatting in Telegram bot messages? Are there other formatting options like underline available?