一键导入
yux-publish-zhihu
Publish articles to Zhihu (知乎专栏) via automated browser. Triggers on "发知乎", "post to zhihu", "知乎专栏", "zhihu publish", "发布知乎", "知乎文章".
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Publish articles to Zhihu (知乎专栏) via automated browser. Triggers on "发知乎", "post to zhihu", "知乎专栏", "zhihu publish", "发布知乎", "知乎文章".
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | yux-publish-zhihu |
| description | Publish articles to Zhihu (知乎专栏) via automated browser. Triggers on "发知乎", "post to zhihu", "知乎专栏", "zhihu publish", "发布知乎", "知乎文章". |
| user-invocable | true |
| allowed-tools | ["Read","Write","Edit","Bash","Grep","Glob","mcp__chrome-devtools__navigate_page","mcp__chrome-devtools__take_snapshot","mcp__chrome-devtools__take_screenshot","mcp__chrome-devtools__click","mcp__chrome-devtools__fill","mcp__chrome-devtools__press_key","mcp__chrome-devtools__evaluate_script","mcp__chrome-devtools__wait_for","mcp__chrome-devtools__type_text"] |
| metadata | {"author":"wuyuxiangX","version":"1.0.0"} |
Match user's language: Respond in the same language the user uses.
PLUGIN_DIR is the root of this plugin (two levels above this SKILL.md directory).
Resolve: PLUGIN_DIR = ${SKILL_DIR}/../..
| Script | Path | Purpose |
|---|---|---|
zhihu-publish.ts | ${PLUGIN_DIR}/scripts/zhihu/zhihu-publish.ts | MDX/Markdown → Zhihu HTML conversion + clipboard copy |
npx -y bunCheck ${SKILL_DIR}/EXTEND.md or user config path for settings:
# Check project-level first
test -f .yux-publish/yux-publish-zhihu/EXTEND.md && echo "project"
# Then user-level
test -f "$HOME/.yux-publish/yux-publish-zhihu/EXTEND.md" && echo "user"
Supported settings:
| Key | Default | Description |
|---|---|---|
default_theme | zhihu | HTML rendering theme |
default_tags | empty | Default topic tags (comma-separated) |
default_action | draft | Default action: draft or publish |
Priority: CLI arguments > Frontmatter > EXTEND.md > Skill defaults
Copy this checklist and check off items as you complete them:
Publishing Progress:
- [ ] Step 0: Load preferences (EXTEND.md)
- [ ] Step 1: Convert content → HTML
- [ ] Step 2: Validate metadata
- [ ] Step 3: Dry-run checkpoint
- [ ] Step 4: Ensure browser debug port
- [ ] Step 5: Check Zhihu login status
- [ ] Step 6: Navigate to article editor
- [ ] Step 7: Fill title
- [ ] Step 8: Paste content into editor
- [ ] Step 9: Add topic tags
- [ ] Step 10: Save draft or publish
- [ ] Step 11: Report completion
Read EXTEND.md and parse configuration.
Input type detection:
| Input Type | Detection | Action |
|---|---|---|
| MDX file | Path ends with .mdx | Run conversion script |
| Markdown file | Path ends with .md | Run conversion script |
| HTML file | Path ends with .html | Use directly, skip to Step 2 |
Execute conversion:
npx -y bun ${PLUGIN_DIR}/scripts/zhihu/zhihu-publish.ts <file> --dry-run
Parse JSON output to get: title, description, tags, htmlPath, htmlContentPath, contentLength, imageCount
| Field | If Missing |
|---|---|
| Title | Prompt user or auto-extract from content |
| Description | Auto-extract from first paragraph (truncate to 120 chars) |
| Tags | Use EXTEND.md defaults, or prompt user |
If user specified --dry-run, show metadata summary and stop:
Zhihu Article Preview:
Title: [title]
Description: [description]
Tags: [tag list]
Content Length: [character count]
Images: [image count]
HTML Preview: [htmlPath]
Check if browser debug port is available:
curl -s http://127.0.0.1:9222/json/version
If unavailable:
/Applications/Arc.app/Contents/MacOS/Arc --remote-debugging-port=9222
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
mcp__chrome-devtools__navigate_page → https://www.zhihu.commcp__chrome-devtools__take_snapshot → check page contentIf not logged in:
Zhihu not logged in. Please log in manually:
1. Open https://www.zhihu.com/signin in the browser
2. Log in via SMS code or QR scan
3. Tell me when done
Use mcp__chrome-devtools__wait_for to detect login completion (user avatar appears).
mcp__chrome-devtools__navigate_page({ url: "https://zhuanlan.zhihu.com/write" })
Wait for editor to load:
mcp__chrome-devtools__wait_for — wait for title input to appearmcp__chrome-devtools__take_snapshot — confirm editor DOM structuremcp__chrome-devtools__take_snapshot — find title input areamcp__chrome-devtools__click — click title inputmcp__chrome-devtools__fill or mcp__chrome-devtools__type_text — enter titleZhihu title limit: Max 100 characters. If too long, truncate and prompt user.
Primary method — Clipboard paste:
npx -y bun ${PLUGIN_DIR}/scripts/zhihu/zhihu-publish.ts <file> --copy-html
mcp__chrome-devtools__take_snapshot — find content editor areamcp__chrome-devtools__click — click editor areamcp__chrome-devtools__press_key({ key: "Meta+a" }) — select all (clear placeholder)mcp__chrome-devtools__press_key({ key: "Meta+v" }) — pasteVerify paste result:
mcp__chrome-devtools__take_snapshot — check editor content is filledFallback method — JavaScript ClipboardEvent simulation (recommended):
If clipboard paste fails, read htmlContentPath file content and inject via evaluate_script.
CRITICAL: Zhihu editor is based on Draft.js. Content injection priority:
mcp__chrome-devtools__evaluate_script({
function: "() => { const editor = document.querySelector('[contenteditable=\"true\"]'); if (!editor) return 'editor_not_found'; editor.focus(); document.execCommand('selectAll'); document.execCommand('delete'); const html = decodeURIComponent('ENCODED_HTML'); const dt = new DataTransfer(); dt.setData('text/html', html); dt.setData('text/plain', ''); const evt = new ClipboardEvent('paste', { clipboardData: dt, bubbles: true, cancelable: true }); editor.dispatchEvent(evt); return 'ok'; }"
})
Note: URL-encode HTML content before passing to decodeURIComponent. dispatchEvent returning false is normal (Draft.js calls preventDefault() to handle paste).
If Chrome DevTools MCP connection times out (common with many tabs), use CDP REST API + WebSocket directly:
# 1. Open new tab
curl --noproxy '*' -s -X PUT 'http://127.0.0.1:9222/json/new?https://zhuanlan.zhihu.com/write'
# 2. Use Runtime.evaluate via WebSocket
mcp__chrome-devtools__take_snapshot — find topic tag areamcp__chrome-devtools__type_text — enter tag text
c. mcp__chrome-devtools__wait_for — wait for autocomplete dropdown
d. mcp__chrome-devtools__take_snapshot — view dropdown options
e. mcp__chrome-devtools__click — click matching option
f. If no exact match, press Enter for custom tagZhihu limit: Max 5 topic tags.
Based on default_action or user instruction:
Save as draft (default):
mcp__chrome-devtools__take_snapshot — find "保存草稿" buttonmcp__chrome-devtools__click — click savemcp__chrome-devtools__wait_for — wait for success messagePublish:
mcp__chrome-devtools__take_snapshot — find "发布" buttonmcp__chrome-devtools__click — click publishmcp__chrome-devtools__wait_for — wait for publish successIMPORTANT: Always save as draft by default, unless user explicitly says "发布"/"直接发布"/"publish".
Zhihu Publishing Complete!
Input: [file type] - [file path]
Article:
Title: [title]
Description: [description]
Tags: [tag list]
Images: [N] images
Content: [character count] characters
Result:
[Saved as draft / Published]
Next Steps:
Manage articles: https://zhuanlan.zhihu.com/write
| Issue | Solution |
|---|---|
| Browser debug port unavailable | Close existing browser process, restart with debug mode |
| Zhihu login expired | Prompt user to manually re-login in browser |
| Editor load timeout | Refresh page and retry, check network connection |
| Clipboard paste loses formatting | Switch to JavaScript injection method |
| Topic tag no match | Use closest suggestion, or press Enter for custom tag |
| Title exceeds 100 chars | Truncate and prompt user to confirm |
| Images fail to load | Zhihu auto-downloads images — takes time, check in editor after saving draft |
| Content style abnormal | Zhihu editor overrides some styles, check actual result after publishing |
Analyze a blog article's structure to plan optimal image placement, then generate and insert AI images. This is the blog-specific image workflow — it reads a markdown article, identifies where images should go, creates a plan, and generates images that fit each section. Use when the user wants images added to an existing article — e.g., "analyze article images", "suggest images for this post", "generate article images", "分析文章配图", "生成文章配图", "插入文章配图". Do NOT use for standalone image generation (use yux-nano-banana instead). After generating, use yux-blog-oss to upload images to CDN.
Generate images via OpenRouter API with user-selected models. Supports any OpenRouter image model (Gemini, Flux, etc.), prompt optimization, text-to-image, and image editing. Triggers on "generate image", "create image", "draw", "nano banana", "image generation", "生成图片", "画图", "图像生成", "信息卡片".
Commit changes with conventional commit messages and sync to Linear. Triggers on "linear commit", "commit and sync", "save progress", "提交代码".
Start working on a Linear issue with worktree isolation. Triggers on "start task", "linear start", "work on LIN-123", "begin task", "开始任务".
Triage Linear inbox issues with AI classification. Triggers on "pm triage", "triage inbox", "classify issues", "process inbox", "处理反馈".
Initialize Linear integration for current project. Triggers on "linear init", "初始化linear", "setup linear", "configure linear", "连接linear".