--- id: telegramify-markdown version: "1.2.0" license: MIT license_treatment: permissive maintenance: active --- # telegramify-markdown — Convert Markdown to Telegram plain text + MessageEntity pairs License: permissive · Maintenance: active · Downloads: 227.8K/mo ## 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 above — 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 pip install telegramify-markdown uv add telegramify-markdown 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_current - Install friction: low - Maintenance: active - Downloads: 227.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags markdown to telegram bot api, telegram messageentity converter, markdown telegram formatting, telegram text entities, convert markdown telegram, telegram bot markdown parser, telegram rich messages, telegram-bot, markdown-parser, llm-output [View on SkillFed](https://skillfed.io/packages/telegramify-markdown) · [View on PyPI](https://pypi.org/project/telegramify-markdown/)