Tg Markdown To Rich logo

Tg Markdown To Rich

Community
serejaris
tg-markdown-to-rich

Use when converting Markdown documents, reports, or any text content into a Telegram Rich Message for delivery via a bot. Triggers: "send markdown to Telegram", "convert doc to rich message", "publish report to bot", "format markdown for sendRichMessage", "telegram rich message from file". Produces an InputRichMessage JSON object ready for Telegram Bot API 10.2 sendRichMessage, including file_id, URL, and multipart upload media bindings.

Overview

Publisherserejaris
Repositorytelegram-skills
Skill nametg-markdown-to-rich
Stars
35
Forks
4
Bundled files
3
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by serejaris on GitHub. Read the source before you install it.

Installation

Install the Tg Markdown To Rich AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/serejaris/telegram-skills/tree/main/skills/tg-markdown-to-rich
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/serejaris/telegram-skills.git /tmp/telegram-skills
mkdir -p .claude/skills
cp -r /tmp/telegram-skills/skills/tg-markdown-to-rich .claude/skills/tg-markdown-to-rich
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Tg Markdown To Rich in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Tg Markdown To Rich on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Tg Markdown To Rich is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

tg-markdown-to-rich

The converter uses Python 3 standard library only. Direct sending requires network access to api.telegram.org and TELEGRAM_BOT_TOKEN.

Converts a Markdown file (or stdin) into a Telegram InputRichMessage JSON object. The output uses the markdown field of InputRichMessage and is ready to pass directly to sendRichMessage.

See also: ../tg-rich-messages/SKILL.md for composing rich messages programmatically.


Usage

bash
# File input → stdout JSON
python3 scripts/md2rich.py document.md

# Pipe stdin
cat report.md | python3 scripts/md2rich.py

# Additional flags
python3 scripts/md2rich.py document.md --rtl
python3 scripts/md2rich.py document.md --skip-entity-detection
python3 scripts/md2rich.py document.md \
  --media cover=photo=AgAC...file_id \
  --media voice=voice_note=https://cdn.example.com/briefing.ogg

# Bindings with player metadata (duration, performer, title, has_spoiler)
python3 scripts/md2rich.py document.md --media-json bindings.json

# Upload local files: each attach://NAME needs a matching --attach NAME=PATH
python3 scripts/md2rich.py document.md \
  --media-json bindings.json \
  --attach cover_file=./cover.png \
  --attach answer_file=./answer.mp3

# Send directly via Telegram Bot API (multipart when --attach is used)
TELEGRAM_BOT_TOKEN=<token> python3 scripts/md2rich.py document.md \
  --send --chat-id <chat_id>

--media covers the common ID=TYPE=SOURCE case. Use --media-json when a binding needs fields that syntax cannot express — an audio track's duration, performer, and title, or has_spoiler on a photo:

json
[
  {
    "id": "answer",
    "media": {
      "type": "audio",
      "media": "attach://answer_file",
      "duration": 4,
      "performer": "Voice 2.0",
      "title": "Answer: 323"
    }
  }
]

Exit codes

CodeMeaning
0Converted, or sent and acknowledged
1Definite failure — limit exceeded, bad binding, or a 4xx from Telegram
2Unknown outcome — 429, 5xx, or a transport failure during --send

Code 2 is not a retry signal. The message may already be in the chat; resending duplicates it. Check the target chat before any second attempt.

Output is a JSON object:

json
{
  "markdown": "# Title\n\n![](tg://photo?id=cover)",
  "media": [
    {"id": "cover", "media": {"type": "photo", "media": "AgAC...file_id"}}
  ]
}

Pass this as the rich_message parameter to sendRichMessage.


Markdown → Rich block mapping

Markdown syntaxRich block / inline
# H1 … ###### H6heading block (size 1–6)
Paragraph textparagraph block
**bold** / __bold__bold inline
*italic* / _italic_italic inline
`code`code inline
~~strikethrough~~strikethrough inline
==marked==marked inline
||spoiler||spoiler inline
```lang … ```pre block (with language)
[text](url)url inline
[text](mailto:…)email_address inline
[text](tel:…)phone_number inline
[text](tg://user?id=…)text_mention inline
$LaTeX$mathematical_expression inline
$$LaTeX$$ / ```mathmathematical_expression block
---divider block
> textblockquote block
- item / * itemlist block (unordered)
1. itemlist block (ordered)
- [ ] task / - [x] tasklist block with checkbox
GFM table | … |table block
![alt](https://…) (block-level)photo block (with optional caption from title)
[^id]: … footnotereference inline + reference_link
<u> / <ins>underline inline (HTML pass-through)
<sub> / <sup>subscript / superscript inline
<aside>…<cite>…</cite></aside>pullquote block
<details [open]><summary>…</summary>…</details>details block
<tg-collage>…</tg-collage>collage block
<tg-slideshow>…</tg-slideshow>slideshow block

Limits enforced (exit 1 on violation)

LimitValue
Max characters (UTF-8)32 768
Max blocks (incl. nested)500
Max nesting depth16
Max media blocks50
Max table columns20

Unsupported inputs and fallback behavior

InputBehavior
tg://photo, tg://video, tg://audioValidated both ways against --media / --media-json bindings: a reference without a binding and a binding without a reference are both exit 1
file_id or HTTP/HTTPS sourceSent in JSON through InputRichMessage.media
attach://name sourceUploaded via multipart when --attach name=path is supplied; without it, exit 1 before any request
Nested blocks inside table cellsGFM spec disallows this; content treated as inline text (Telegram cells accept only inline formatting)
Other non-HTTP media URIWarning to stderr; passed through for Telegram validation
<tg-map> HTML tagPassed through unchanged; not generatable from plain Markdown
RichBlockThinkingNot producible from Markdown (only valid in sendRichMessageDraft)
HTML tags not in Rich HTML specPassed through; Telegram will ignore unknown tags

References

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Tg Markdown To Rich AI skill do?

Use when converting Markdown documents, reports, or any text content into a Telegram Rich Message for delivery via a bot. Triggers: "send markdown to Telegram", "convert doc to rich message", "publish report to bot", "format markdown for sendRichMessage", "telegram rich message from file". Produces an InputRichMessage JSON object ready for Telegram Bot API 10.2 sendRichMessage, including file_id, URL, and multipart upload media bindings.

Why use Tg Markdown To Rich on TypingMind?

Because you install it once and use it with any model. Tg Markdown To Rich is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Tg Markdown To Rich in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/serejaris/telegram-skills/tree/main/skills/tg-markdown-to-rich. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Tg Markdown To Rich?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Tg Markdown To Rich?

As many as you like. As long as a model supports skills, you can use Tg Markdown To Rich with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Tg Markdown To Rich AI skill free?

Yes. It is published on GitHub by serejaris under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇