Core idea: beautiful by default, done in one click
Execution flow (done in 3 steps)
Step 1: Find the article
| Scenario | Handling method |
|---|---|
| User provided a file path | Use it directly |
| User pasted the content | First Write and save as .md |
| Just finished writing an article | Automatically find the latest .md file |
| Only said "beautify article" | Ask for the path |
# 自动检测最新文章
ls -t *.md 2>/dev/null | head -1
Step 2: Convert using the beautiful template
Use VSCode 蓝色科技风 template by default, no need to ask the user to choose a theme.
Execution method:
- Read the
examples/VSCode 蓝色科技风.htmltemplate - Skip the H1 heading in Markdown(WeChat has a separate title bar)
- Add at the beginning of the HTML:
<!-- ⚠️ 标题请在微信公众号编辑器中单独填写 --> - Map the Markdown content to the template's component structure:
- Intro block → article opening lead-in
- Numbered section heading → H2 heading
- Feature card → key points list
- Operation steps → tutorial content
- Convert code block format (if there is code):
python scripts/convert-code-blocks.py input.html output.html - Output
{文件名}_formatted.html
If the user is not satisfied with the default template, then provide options:
| Template | Applicable scenario |
|---|---|
| VSCode blue tech style | Technical articles (default) |
| Red vs Blue Showdown · In-depth Review | Comparative review |
| Geek dark style | In-depth technical |
| Modern minimalist style | General articles |
Step 3: Tell the user the result
✅ 文章已格式化!
文件:{输出路径}
你可以:
1. 说"推送到微信"→ 直接发布到公众号草稿箱
2. 在浏览器打开预览:file://{绝对路径}
3. 手动操作:浏览器打开HTML → Ctrl+A全选 → Ctrl+C复制 → 粘贴到微信编辑器
⚠️ 记得在微信编辑器的标题栏填写文章标题
Error handling
| Problem | Solution |
|---|---|
| File not found | Ask the user for the path |
| Code not highlighted | Check whether the Markdown specifies a language |
| Images not displaying | Remind to re-upload in the WeChat editor |
| Styles unsatisfactory | Provide other template options |
Interoperability with other skills
Finish writing the article → Say "beautify article" to trigger this skill → Say "push to WeChat" to trigger publisher