---
name: md2feishu
description: Upload local Markdown files to Feishu documents. Supports headings, paragraphs, lists, tables (auto-split for large tables), code blocks, and quotes.
---

# Markdown to Feishu Document Uploader

Convert and upload local Markdown files to Feishu documents.

## Quick Usage

```bash
cd ~/github/data-service-infra-ai-configurations/skills/team-common/md2feishu

python3 scripts/md2feishu.py \
  --app-id=cli_xxx \
  --app-secret=xxx \
  --file=/path/to/markdown.md \
  --title="Document Title"

# Or append to existing document
python3 scripts/md2feishu.py \
  --app-id=cli_xxx \
  --app-secret=xxx \
  --file=/path/to/markdown.md \
  --doc-id=existing_doc_id
```

## Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `--app-id` | Yes | Feishu App ID |
| `--app-secret` | Yes | Feishu App Secret |
| `--file` | Yes | Path to local Markdown file |
| `--title` | Yes | Title for new document (ignored if --doc-id provided) |
| `--doc-id` | No | Existing document ID (creates new if not provided) |

## Supported Markdown Elements

- ✅ Headings (H1, H2, H3)
- ✅ Paragraphs
- ✅ Unordered lists (`- ` or `* `)
- ✅ Ordered lists (`1. `)
- ✅ Tables (auto-split for tables > 8 rows)
- ✅ Code blocks (```)
- ✅ Blockquotes (`>`)
- ✅ Horizontal rules

## Table Handling

- **Small tables** (≤8 rows): Uploaded as single table
- **Large tables** (>8 rows): Automatically split into multiple tables with header row preserved
- **Column validation**: Raises error if any row has different column count than header

## Example

```bash
# Create new document
python3 scripts/md2feishu.py \
  --app-id=cli_a91c042e98b8dcc9 \
  --app-secret=BZVSYgxVdAIAVkYzH7aa7c3sOzv7oczq \
  --file=~/openclaw-team/skill-scripts/inspection-2026-03-16.md \
  --title="Daily Report"

# Append to existing document
python3 scripts/md2feishu.py \
  --app-id=cli_a91c042e98b8dcc9 \
  --app-secret=BZVSYgxVdAIAVkYzH7aa7c3sOzv7oczq \
  --file=~/openclaw-team/skill-scripts/inspection-2026-03-16.md \
  --doc-id=JMxxx
```

## Output

On success, prints:
```
✅ Success!
📄 Document: https://pingcap.feishu.cn/docx/xxx
```

## Requirements

- Python3
- requests library (`pip install requests`)
- Feishu App with permissions: `docx:document`, `docx:document:create`, `docx:document:content`