介绍
# Table Image Skill
将 Markdown 表格渲染为 PNG 图像,以便在不支持 Markdown 表格的消息平台上发送。
## 前置条件
安装 tablesnap:
```bash go install github.com/joargp/tablesnap/cmd/tablesnap@latest ```
或者从源码构建: ```bash git clone https://github.com/joargp/tablesnap.git cd tablesnap go build -o tablesnap ./cmd/tablesnap ```
## 使用方法
```bash echo "| Header 1 | Header 2 | |----------|----------| | Data 1 | Data 2 |" | tablesnap -o /tmp/table.png ```
然后使用 `MEDIA:/tmp/table.png` 发送。
## 选项
| 标志 | 默认值 | 描述 | |------|---------|-------------| | `-i` | stdin | 输入文件 | | `-o` | stdout | 输出文件 | | `--theme` | dark | 主题:`dark` 或 `light` | | `--font-size` | 14 | 字体大小(像素) | | `--padding` | 10 | 单元格内边距(像素) |
## Emoji 支持
**内置**(开箱即用):✅ ❌ 🔴 🟢 🟡 ⭕ ⚠️
**完整 Emoji**(一次性下载): ```bash tablesnap emojis install ```
在安装完整 Emoji 集之前,不支持的 Emoji 将渲染为 □。
## 示例工作流
```bash # Create table image echo "| Task | Status | |------|--------| | Build | ✅ | | Deploy | 🚀 |" | tablesnap -o /tmp/table.png
# Send in reply MEDIA:/tmp/table.png ```
## 注意事项
- 默认为深色主题(匹配 Telegram/Discord 深色模式) - 自动调整大小以适应内容 - 输出大小约为 10-20KB(适合消息发送) - 跨平台(内嵌 Inter 字体)
## 链接
- [tablesnap 仓库](https://github.com/joargp/tablesnap)