npx skills add https://github.com/zc277584121/marketing-skills --skill md-to-feishu将本地 Markdown 文件转换为飞书文档,并自动上传图片。
用户只需提供 Markdown 文件路径。标题是可选的——如果未提供,则自动提取(见下文)。
# 标题 —— 将其用作标题。# 标题,则扫描内容并根据主题生成一个简洁的描述性标题。按顺序尝试每个选项。使用 第一个可用的选项。
which uvx
如果 uvx 可用,则运行命令为:
uvx feishu-docx create "<TITLE>" -f <MARKDOWN_FILE_PATH>
如果 uvx 在 Python < 3.11 环境下运行,添加 --python 3.11:
Convert a local Markdown file into a Feishu document, with automatic image upload.
The user only needs to provide a Markdown file path. Title is optional — if not provided, extract it automatically (see below).
# heading — use that as the title.# heading exists, scan the content and generate a concise, descriptive title based on the topic.Try each option in order. Use the first one that works.
which uvx
If uvx is available, the run command is:
uvx feishu-docx create "<TITLE>" -f <MARKDOWN_FILE_PATH>
If runs with Python < 3.11, add :
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
uvx --python 3.11 feishu-docx create "<TITLE>" -f <MARKDOWN_FILE_PATH>
which feishu-docx
如果找到,检查 Python 版本:
python3 --version
如果 Python >= 3.11,则运行命令为:
feishu-docx create "<TITLE>" -f <MARKDOWN_FILE_PATH>
如果既没有找到 uvx 也没有找到 feishu-docx,则告知用户:
feishu-docx需要 Python >= 3.11。通过以下方式之一安装:# 推荐:安装 uv,然后直接运行而无需全局安装 curl -LsSf https://astral.sh/uv/install.sh | sh uvx feishu-docx create "Title" -f file.md # 或者:使用 pip 全局安装(需要 Python >= 3.11) pip install feishu-docx必须先配置飞书凭据:
feishu-docx config set --app-id <APP_ID> --app-secret <APP_SECRET>
然后停止并等待用户设置环境。
feishu-docx 工具无法处理 Mermaid 代码块。在上传之前,检查 Markdown 是否包含任何 ````mermaid` 代码块,并先将它们转换为图片。
读取 Markdown 文件,检查是否包含任何 ````mermaid` 围栏代码块。如果 没有找到,则跳转到步骤 4。
将原始 Markdown 文件复制到同一目录下的一个临时文件中(以便相对图片路径仍然有效):
<original-name>.feishu-tmp.md
例如:blog_post.md → blog_post.feishu-tmp.md
所有后续修改都在这个临时副本上进行。原始文件永远不会被修改。
对于临时文件中的每个 mermaid ... 代码块,使用 mermaid.ink API 将其渲染为 PNG 图片:
import base64, urllib.request
def render_mermaid(code: str, output_path: str):
"""通过 mermaid.ink API 将 Mermaid 图表渲染为 PNG。"""
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())
重要: 必须包含 User-Agent 请求头 —— 没有它,mermaid.ink 会返回 403 错误。
将渲染的图片保存到与 Markdown 文件相同的目录中,使用基于图表内容的描述性文件名:
mermaid-architecture-overview.png, mermaid-data-flow.pngmermaid-1.png, diagram.png在临时副本中,将每个 mermaid ... 代码块替换为 Markdown 图片引用:

使用从临时文件到渲染图片的相对路径。
从此时起,临时文件成为步骤 4 中使用的 <MARKDOWN_FILE_PATH>。
如果在步骤 3 中创建了临时文件:
*.feishu-tmp.md)向用户展示:
如果因身份验证错误而失败,提醒用户配置凭据:
feishu-docx config set --app-id <APP_ID> --app-secret <APP_SECRET>
每周安装数
88
代码仓库
首次出现
6 天前
安全审计
安装于
opencode88
antigravity88
claude-code88
github-copilot88
codex88
warp88
uvx--python 3.11uvx --python 3.11 feishu-docx create "<TITLE>" -f <MARKDOWN_FILE_PATH>
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>
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.
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.
Read the Markdown file and check if it contains any ````mermaid` fenced code blocks. If none are found, skip to Step 4.
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.
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:
mermaid-architecture-overview.png, mermaid-data-flow.pngmermaid-1.png, diagram.pngIn the temp copy, replace each mermaid ... block with a Markdown image reference:

Use relative paths from the temp file to the rendered images.
From this point, the temp file becomes the <MARKDOWN_FILE_PATH> used in Step 4.
If a temp file was created in Step 3:
*.feishu-tmp.md)Show the user:
If it fails with authentication errors, remind the user to configure credentials:
feishu-docx config set --app-id <APP_ID> --app-secret <APP_SECRET>
Weekly Installs
88
Repository
First Seen
6 days ago
Security Audits
Installed on
opencode88
antigravity88
claude-code88
github-copilot88
codex88
warp88
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
46,600 周安装