md-to-feishu
zc277584121/marketing-skills
Convert Markdown files to Feishu documents with automatic image uploading and Mermaid diagram rendering.
What is md-to-feishu?
Converts local Markdown files into Feishu (Lark) documents using the feishu-docx CLI tool. Automatically uploads embedded images and converts Mermaid diagrams to PNG. Use this when you need to publish Markdown content to Feishu without manual formatting.
- Extracts document title from first # heading or generates one automatically
- Detects and converts Mermaid code blocks to PNG images via mermaid.ink API
- Uploads local images referenced in Markdown to Feishu
- Handles runtime environment detection (uvx, installed feishu-docx, or installation guidance)
- Cleans up temporary files and rendered diagrams after upload
- Reports conversion results including document ID and upload status
How to install md-to-feishu
npx skills add https://github.com/zc277584121/marketing-skills --skill md-to-feishu- Python >= 3.11
- Feishu app credentials (APP_ID and APP_SECRET) configured via `feishu-docx config set`
- Either uvx installed, or feishu-docx installed globally
How to use md-to-feishu
- 1.Provide the path to your Markdown file (title is optional)
- 2.The skill checks for Mermaid blocks and converts them to PNG images if found
- 3.Runs the feishu-docx command from the Markdown file's directory to resolve relative image paths
- 4.Uploads the document and all referenced images to Feishu
- 5.Cleans up temporary files and reports the created document ID
Use cases
- Publishing blog posts or documentation from Markdown to Feishu team workspace
- Converting technical specifications with diagrams into shareable Feishu documents
- Batch migrating local Markdown files to Feishu without manual image re-uploading
- Sharing architecture diagrams and flowcharts by rendering Mermaid blocks automatically
- Technical writers publishing to Feishu
- Teams migrating documentation from local Markdown to Feishu
- Engineers sharing technical specs and diagrams with non-technical stakeholders
md-to-feishu FAQ
The skill scans the content and generates a concise, descriptive title based on the topic. You can also explicitly provide a title to override auto-detection.
Yes. Run `feishu-docx config set --app-id <APP_ID> --app-secret <APP_SECRET>` once before using the skill. Credentials are stored locally.
They are automatically rendered to PNG images using the mermaid.ink API and embedded in the Feishu document. Temporary PNG files are cleaned up after upload.
Yes. The skill runs from your Markdown file's directory, so relative paths to images work correctly. Images are automatically uploaded to Feishu.
The skill provides installation guidance. It recommends installing uv and using `uvx feishu-docx` (no global install needed), or installing globally with pip if Python >= 3.11 is available.
Full instructions (SKILL.md)
Source of truth, from zc277584121/marketing-skills.
name: md-to-feishu description: Convert local Markdown files to Feishu (Lark) documents with automatic image uploading. Uses the feishu-docx CLI tool.
Markdown to Feishu Document
Convert a local Markdown file into a Feishu document, with automatic image upload.
User Input
The user only needs to provide a Markdown file path. Title is optional — if not provided, extract it automatically (see below).
Step 1: Determine the Document Title
- Read the Markdown file and look for the first
# heading— use that as the title. - If no
# headingexists, scan the content and generate a concise, descriptive title based on the topic. - If the user explicitly provides a title, use that instead.
Step 2: Check the Runtime Environment
Try each option in order. Use the first one that works.
Option A: uvx (preferred)
which uvx
If uvx is available, the run command is:
uvx feishu-docx create "<TITLE>" -f <MARKDOWN_FILE_PATH>
If uvx runs with Python < 3.11, add --python 3.11:
uvx --python 3.11 feishu-docx create "<TITLE>" -f <MARKDOWN_FILE_PATH>
Option B: feishu-docx already installed
which feishu-docx
If found, check Python version:
python3 --version
If Python >= 3.11, the run command is:
feishu-docx create "<TITLE>" -f <MARKDOWN_FILE_PATH>
Option C: Nothing available — install guidance
If neither uvx nor feishu-docx is found, tell the user:
feishu-docxrequires Python >= 3.11. Install with one of:# Recommended: install uv, then run directly without global install curl -LsSf https://astral.sh/uv/install.sh | sh uvx feishu-docx create "Title" -f file.md # Or: install globally with pip (Python >= 3.11 required) pip install feishu-docxFeishu credentials must be configured first:
feishu-docx config set --app-id <APP_ID> --app-secret <APP_SECRET>
Then stop and wait for the user to set up the environment.
Step 3: Pre-process Mermaid Blocks
The feishu-docx tool cannot handle Mermaid code blocks. Before uploading, check if the Markdown contains any ```mermaid blocks and convert them to images first.
3a: Scan for Mermaid blocks
Read the Markdown file and check if it contains any ```mermaid fenced code blocks. If none are found, skip to Step 4.
3b: Create a temporary copy
Copy the original Markdown file to a temp file in the same directory (so relative image paths still work):
<original-name>.feishu-tmp.md
For example: blog_post.md → blog_post.feishu-tmp.md
All subsequent modifications happen on this temp copy. The original file is never modified.
3c: Render Mermaid diagrams to PNG
For each ```mermaid ... ``` block in the temp file, render it to a PNG image using the mermaid.ink API:
import base64, urllib.request
def render_mermaid(code: str, output_path: str):
"""Render a Mermaid diagram to PNG via mermaid.ink API."""
encoded = base64.urlsafe_b64encode(code.encode()).decode()
url = f"https://mermaid.ink/img/{encoded}?bgColor=white"
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
resp = urllib.request.urlopen(req, timeout=30)
with open(output_path, "wb") as f:
f.write(resp.read())
Important: The User-Agent header is required — mermaid.ink returns 403 without it.
Save rendered images to the same directory as the Markdown file, using descriptive filenames based on diagram content:
- GOOD:
mermaid-architecture-overview.png,mermaid-data-flow.png - BAD:
mermaid-1.png,diagram.png
3d: Replace Mermaid blocks with image references
In the temp copy, replace each ```mermaid ... ``` block with a Markdown image reference:

Use relative paths from the temp file to the rendered images.
3e: Use the temp file for upload
From this point, the temp file becomes the <MARKDOWN_FILE_PATH> used in Step 4.
Step 4: Run the Command
- Run from the directory where the Markdown file lives (or where its relative image paths resolve correctly), so that local image references work.
- The tool will:
- Convert Markdown blocks to Feishu format
- Automatically upload local images referenced in the Markdown
- Wait ~10s for block consistency before uploading images
Step 5: Clean Up
If a temp file was created in Step 3:
- Delete the temp Markdown file (
*.feishu-tmp.md) - Delete all rendered Mermaid PNG files created in Step 3c (they were only needed for the upload)
Step 6: Report Result
Show the user:
- Number of blocks converted and images uploaded
- The created document ID
- Success or failure status
If it fails with authentication errors, remind the user to configure credentials:
feishu-docx config set --app-id <APP_ID> --app-secret <APP_SECRET>
Related skills
More from zc277584121/marketing-skills and the wider catalog.

mermaid-to-gif
Convert Mermaid diagrams to animated GIFs with context-aware animation styles (progressive, highlight-walk, pulse-flow, wave).

mermaid-to-image
Convert Mermaid diagram code blocks to PNG images using mermaid.ink API.

raw-video-processing
Remove silent segments and speed up raw screen recordings with FFmpeg-based post-processing.

remove-ai-style
Remove AI-generated writing patterns to make text sound more natural and human-like in Chinese or English.

screenshot-compression
Compress PNG and JPEG screenshots in place using pngquant and jpegoptim while preserving format compatibility.

video-to-gif
Convert videos to multiple GIF variants with different quality/size tradeoffs for visual comparison.