This package tries to validate that telegram-flavored markdown is correct and safe to use in sendMessage.
Simple and naive implementation, probably has bugs but good enough for my personal use case.
Supports all features of MarkdownV2 Style.
Contributions are welcome!
pip install validate-telegram-markdown
from validate_telegram_markdown import validate_markdown
message = "*bold*"
try:
validate_markdown(message)
except ValueError:
# something isn't right
raise
# or here you can safely use message in telegram sendMessage method