telegramify-markdown
Convert Markdown to Telegram plain text + MessageEntity pairs
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-markdownuv
uv add telegramify-markdownpoetry
poetry add telegramify-markdownInstalling 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
More Markup packages
PyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
markdown-it-pyA Python markdown parser that converts markdown…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
et-xmlfileet_xmlfile writes large XML files with minimal…
permissive · top 1,000 on PyPI
tomlkitParses and edits TOML files while preserving…
permissive · top 1,000 on PyPI
docstring-parserParses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
slackify-markdownConverts standard Markdown to Slack-compatible…
permissive · top 15,000 on PyPI
strip-markdownConverts markdown text to plain text, removing…
permissive · top 15,000 on PyPI
markdownifyConverts HTML to Markdown, with fine-grained…
permissive · top 1,000 on PyPI
markdown-to-mrkdwnConverts standard Markdown to Slack's mrkdwn…
permissive · top 5,000 on PyPI
mkdocs-mermaid2-pluginA MkDocs plugin that renders Mermaid diagram…
permissive · top 5,000 on PyPI
md2SlackConverts Markdown syntax into Slack-compatible…
permissive · top 15,000 on PyPI
django-markdownifyA Django template filter that converts Markdown…
permissive · top 15,000 on PyPI
py-gfmConverts GitHub-Flavored Markdown to HTML using…
permissive · top 15,000 on PyPI
pptx2mdConverts PowerPoint .pptx files to markdown,…
permissive · top 15,000 on PyPI
mdit-plainConverts markdown documents to plain text by…
permissive · top 15,000 on PyPI