agentleFS
shali10shali10/awesome-agent-skills/skills/telegram-pipe-table-rendering/SKILL.md

telegram-pipe-table-rendering

Skill1 starsChanged 2 months agoMITView on GitHub

Use when sending Markdown tables to Telegram, resolving table degradation, CJK East Asian character alignment, and mobile viewport wrapping.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Double delivery on standalone scripts: When writing direct Bot API delivery scripts, ensure output is not printed to stdout if cron …

    line 62

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Telegram Markdown Pipe Table Rendering & CJK Alignment

Overview

A comprehensive engineering guide and solution for rendering Markdown pipe tables in Telegram bots without broken layouts. It covers Bot API native rendering, CJK character width compensation, standalone cron delivery bypass, and automatic mobile card degradation.

When to Use & When NOT to Use

When to Use

  • Formatting LLM tabular output for Telegram bots (Hermes, python-telegram-bot, Aiogram).
  • Fixing character misalignment caused by mixed Chinese/Japanese/Korean and ASCII characters in Monospace tables.
  • Preventing wide tables (>5 columns) from turning into mangled text on mobile Telegram clients.

When NOT to Use

  • Standard web browsers or HTML-native rendering environments where CSS handles table layouts.
  • Platforms with native rich table APIs (e.g. Discord embeds or Slack blocks).

The Telegram Table Truth & Solutions Matrix

Delivery PathNative Table SupportWhat Actually HappensBest Solution
Bot API sendRichMessage✅ YesRenders native GFM pipe tablesPass raw markdown directly to sendRichMessage endpoint
Standard sendMessage (MarkdownV2)❌ NoTelegram has no table syntax in MarkdownV2; `` is just a charPre-format with CJK padding or degrade wide tables to cards
Standalone Cron / Webhook⚠️ PartialOften converted to bullet points by intermediary adaptersDirect Bot API webhook or use telegram-table-renderer package

Python CJK Padding Algorithm

import unicodedata

def get_cjk_width(text: str) -> int:
    """Calculate visual width in monospace terminal font."""
    return sum(2 if unicodedata.east_asian_width(c) in ('W', 'F') else 1 for c in text)

def pad_cjk_cell(text: str, target_width: int, align: str = 'left') -> str:
    current_width = get_cjk_width(text)
    pad = max(0, target_width - current_width)
    if align == 'right':
        return ' ' * pad + text
    elif align == 'center':
        left = pad // 2
        return ' ' * left + text + ' ' * (pad - left)
    return text + ' ' * pad

Common Pitfalls

  1. Tables with ≥6 columns on mobile: Telegram mobile screens are too narrow for 6-column tables; automatically degrade tables with >5 columns into structured bullet cards (🔹 Key: Value).
  2. MarkdownV2 character escaping errors: In MarkdownV2 mode, unescaped reserved characters (_, *, [, ], (, ), ~, >, #, +, -, =, |, {, }, ., !) cause delivery failure.
  3. Double delivery on standalone scripts: When writing direct Bot API delivery scripts, ensure output is not printed to stdout if cron delivery is also enabled.

Verification Checklist

  • Table borders align vertically in Telegram desktop and web clients.
  • CJK characters count as 2 width units during cell padding calculation.
  • Tables with >5 columns gracefully convert to card format when mobile mode is enabled.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.