Telegramify Markdown

1.1.2 · active · verified Fri Apr 17

telegramify-markdown is a Python library designed to convert standard Markdown text into a format compatible with Telegram's MessageEntity system. It processes Markdown syntax and outputs a plain text string along with a list of `MessageEntity` objects, suitable for sending via the Telegram Bot API. The current version is 1.1.2, and it maintains a moderate release cadence based on feature additions and bug fixes.

Common errors

Warnings

Install

Imports

Quickstart

Converts a Markdown string into a tuple containing the plain text and a list of Telegram `MessageEntity` objects. These entities describe the formatting (bold, italic, code, etc.) and their positions in the plain text.

from telegramify_markdown import telegramify_markdown

markdown_text = "Hello, *world*! This is some _italic_ text and `inline code`."
plain_text, entities = telegramify_markdown(markdown_text)

print("Plain Text:", plain_text)
print("Entities:", entities)

# Example of how you might use it with a Telegram bot library (concept)
# bot.send_message(chat_id=12345, text=plain_text, entities=entities)

view raw JSON →