skillfed

telegramify-markdown

Convert Markdown to Telegram plain text + MessageEntity pairs

telegramify-markdown v1.2.0 227.8K downloads/30d#9,165 on PyPI377
Permissive license MIT Active released

What it is and what it does

Telegramify-markdown parses Markdown (including LLM output and GitHub READMEs) and produces (text, entities) tuples ready for the Telegram Bot API's MessageEntity parameter. It handles UTF-16 offset calculation automatically—a requirement Telegram imposes—eliminating the need for MarkdownV2 escaping and parse_mode parameters. The library is built on pyromark (Rust bindings to pulldown-cmark) for speed and correctness.

The package offers multiple output modes: convert() for static text, telegramify() for long documents with automatic splitting and code extraction, richify() for Telegram Bot API 10.1 structured Rich Messages, and streaming variants (DraftStream, EditStream) for token-by-token LLM output. It also supports LaTeX-to-Unicode conversion and optional Mermaid diagram rendering, making it suitable for complex formatted content in Telegram bots.

Use it for:

  • Send formatted LLM output (ChatGPT-like responses) to Telegram without worrying about escaping or parse_mode.
  • Convert GitHub READMEs or other Markdown documents to Telegram messages with proper formatting and entity offsets.
  • Stream token-by-token LLM responses with live draft updates or message edits in Telegram chats.
  • Split long Markdown automatically into multiple Telegram messages while preserving formatting and entity boundaries.
  • Render code blocks as file attachments and Mermaid diagrams as images alongside formatted text in a single flow.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Converts Markdown to Telegram plain text with MessageEntity pairs for direct Bot API use, supporting UTF-16 offset calculation, LaTeX-to-Unicode conversion, and optional Mermaid diagram rendering.

Yes. Active maintenance, no vulnerabilities, low install friction, and a permissive license. Install if you build Telegram bots that send formatted text—especially LLM output, documentation, or complex layouts. The library solves a real Telegram Bot API pain point (UTF-16 entity offsets) and offers both simple (convert) and advanced (streaming, Rich Messages) APIs.

Install

telegramify-markdown on PyPI

pip

pip install telegramify-markdown

uv

uv add telegramify-markdown

poetry

poetry add telegramify-markdown

Installing telegramify-markdown

Before you install

Low friction: pure Python wheel with a single runtime dependency (pyromark). Active maintenance with recent releases and no known vulnerabilities.

License in practice

MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for commercial and proprietary projects.

Quickstart

from telegramify_markdown import convert

md = "**Bold**, _italic_, and `code`."
text, entities = convert(md)

# Send via Telegram Bot API
bot.send_message(chat_id, text, entities=[e.to_dict() for e in entities])

Requires Python 3.10 or later.

Verify before relying

  • Whether LaTeX-to-Unicode and Mermaid rendering work out-of-the-box or require optional dependencies beyond the listed extras.
  • Performance characteristics when processing very large Markdown documents or streaming LLM output.
  • Compatibility with all Telegram Bot API versions and whether Rich Message support (Bot API 10.1) is fully stable.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — pyromark
Maintenance actively maintained — 61 days since the last release
Last repo commit
First released
Downloads 227,807/month — #9,165 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: telegramify_markdown-1.2.0-py3-none-any.whl

Tags

markdown to telegram bot apitelegram messageentity convertermarkdown telegram formattingtelegram text entitiesconvert markdown telegramtelegram bot markdown parsertelegram rich messages
telegram-botmarkdown-parserllm-output

More Markup packages