Install
openclaw skills install md-to-zhihuConvert markdown articles to Zhihu (知乎) publishing format and one-click publish articles. Use when the user wants to publish markdown content to Zhihu, convert articles for Zhihu, or mentions 知乎、知乎专栏、知乎发布、发布到知乎.
openclaw skills install md-to-zhihu将 Markdown 文章转换为知乎文章编辑器可接受的格式,支持多种排版风格预览,并可一键发布到知乎专栏。
# 格式转换依赖
pip install markdown pygments beautifulsoup4
# 一键发布依赖(可选,仅发布时需要)
pip install playwright requests
playwright install chromium
python ~/.cursor/skills/md-to-zhihu/scripts/convert.py input.md
参数说明:
| 参数 | 说明 | 默认值 |
|---|---|---|
input.md | 输入的 Markdown 文件路径 | 必填 |
-o output.html | 输出 HTML 文件路径 | {input}_zhihu.html |
--theme | 主题风格 | zhihu |
--content-only | 仅输出纯净 HTML 内容(用于 API 发布) | 否 |
--dir | 批量转换:指定目录路径 | - |
# 转换目录下所有 .md 文件
python ~/.cursor/skills/md-to-zhihu/scripts/convert.py --dir ./articles
# 批量转换,指定主题
python ~/.cursor/skills/md-to-zhihu/scripts/convert.py --dir ./articles --theme tech
# 首次使用:登录知乎并保存 Cookie
python ~/.cursor/skills/md-to-zhihu/scripts/publish.py --login
# 发布文章
python ~/.cursor/skills/md-to-zhihu/scripts/publish.py input.md
# 保存为草稿
python ~/.cursor/skills/md-to-zhihu/scripts/publish.py input.md --draft
# 指定标题和话题
python ~/.cursor/skills/md-to-zhihu/scripts/publish.py input.md --title "文章标题" --topic "AI,编程"
# 批量发布目录下所有 .md 文件
python ~/.cursor/skills/md-to-zhihu/scripts/publish.py --dir ./articles
# 批量保存为草稿
python ~/.cursor/skills/md-to-zhihu/scripts/publish.py --dir ./articles --draft
# 批量发布,设置话题和自定义间隔(默认60s)
python ~/.cursor/skills/md-to-zhihu/scripts/publish.py --dir ./articles --topic "AI,编程" --delay 30
| 参数 | 说明 | 默认值 |
|---|---|---|
--dir | 批量发布:指定目录路径,发布所有 .md | - |
--delay | 每篇文章发布间隔秒数(防限流) | 60 |
--draft | 仅保存为草稿 | 否 |
--topic | 文章话题,逗号分隔 | - |
Ctrl+V 粘贴--login 登录--login)