From 6e1872590607610f80d3c9b8640df555dbbcc898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jim=20Liu=20=E5=AE=9D=E7=8E=89?= Date: Sat, 28 Feb 2026 11:48:59 -0600 Subject: [PATCH] feat(baoyu-post-to-wechat): add default color preference and modern theme support --- skills/baoyu-post-to-wechat/SKILL.md | 24 +++++++++--- .../references/article-posting.md | 4 +- .../references/config/first-time-setup.md | 39 ++++++++++++++----- .../scripts/wechat-article.ts | 4 +- 4 files changed, 52 insertions(+), 19 deletions(-) diff --git a/skills/baoyu-post-to-wechat/SKILL.md b/skills/baoyu-post-to-wechat/SKILL.md index 4c6f383..61fda6a 100644 --- a/skills/baoyu-post-to-wechat/SKILL.md +++ b/skills/baoyu-post-to-wechat/SKILL.md @@ -48,7 +48,7 @@ test -f "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" && echo "user" │ Not found │ Run first-time setup ([references/config/first-time-setup.md](references/config/first-time-setup.md)) → Save → Continue │ └───────────┴───────────────────────────────────────────────────────────────────────────┘ -**EXTEND.md Supports**: Default theme | Default publishing method (api/browser) | Default author | Default open-comment switch | Default fans-only-comment switch | Chrome profile path +**EXTEND.md Supports**: Default theme | Default color | Default publishing method (api/browser) | Default author | Default open-comment switch | Default fans-only-comment switch | Chrome profile path First-time setup: [references/config/first-time-setup.md](references/config/first-time-setup.md) @@ -64,6 +64,7 @@ First-time setup: [references/config/first-time-setup.md](references/config/firs ```md default_theme: default +default_color: blue default_publish_method: api default_author: 宝玉 need_open_comment: 1 @@ -71,6 +72,10 @@ only_fans_can_comment: 0 chrome_profile_path: /path/to/chrome/profile ``` +**Theme options**: default, grace, simple, modern + +**Color presets**: blue, green, vermilion, yellow, purple, sky, rose, olive, black, gray, pink, red, orange (or hex value) + **Value priority**: 1. CLI arguments 2. Frontmatter @@ -134,6 +139,8 @@ Check and load EXTEND.md settings (see Preferences section above). **CRITICAL**: If not found, complete first-time setup BEFORE any other steps or questions. Resolve and store these defaults for later steps: +- `default_theme` (default `default`) +- `default_color` (omit if not set — theme default applies) - `default_author` - `need_open_comment` (default `1`) - `only_fans_can_comment` (default `0`) @@ -201,13 +208,18 @@ B) Continue - provide HTML file manually - EXTEND.md `default_theme` (loaded in Step 0) - Fallback: `default` -2. **Execute conversion** (using the discovered skill), **always pass `--theme`**: +2. **Resolve color** (first match wins): + - CLI `--color` argument + - EXTEND.md `default_color` (loaded in Step 0) + - Omit if not set (theme default applies) + +3. **Execute conversion** (using the discovered skill), **always pass `--theme`**: ```bash -npx -y bun ${MD_TO_HTML_SKILL_DIR}/scripts/main.ts --theme +npx -y bun ${MD_TO_HTML_SKILL_DIR}/scripts/main.ts --theme [--color ] ``` -**CRITICAL**: Always include `--theme` parameter. Never omit it, even if using `default`. +**CRITICAL**: Always include `--theme` parameter. Never omit it, even if using `default`. Only include `--color` if explicitly set by user or EXTEND.md. 3. **Parse JSON output** to get: `htmlPath`, `title`, `author`, `summary`, `contentImages` @@ -307,7 +319,7 @@ WeChat Publishing Complete! Input: [type] - [path] Method: API -Theme: [theme name] +Theme: [theme name] [color if set] Article: • Title: [title] @@ -334,7 +346,7 @@ WeChat Publishing Complete! Input: [type] - [path] Method: Browser -Theme: [theme name] +Theme: [theme name] [color if set] Article: • Title: [title] diff --git a/skills/baoyu-post-to-wechat/references/article-posting.md b/skills/baoyu-post-to-wechat/references/article-posting.md index 8204c8a..080e7ee 100644 --- a/skills/baoyu-post-to-wechat/references/article-posting.md +++ b/skills/baoyu-post-to-wechat/references/article-posting.md @@ -20,9 +20,9 @@ npx -y bun ./scripts/wechat-article.ts --markdown article.md --author "作者名 | Parameter | Description | |-----------|-------------| | `--markdown ` | Markdown file to convert and post | -| `--theme ` | Theme: default, grace, or simple | +| `--theme ` | Theme: default, grace, simple, modern | | `--title ` | Override title (auto-extracted from markdown) | -| `--author ` | Author name (default: 宝玉) | +| `--author ` | Author name | | `--summary ` | Article summary | | `--html ` | Pre-rendered HTML file (alternative to markdown) | | `--profile ` | Chrome profile directory | diff --git a/skills/baoyu-post-to-wechat/references/config/first-time-setup.md b/skills/baoyu-post-to-wechat/references/config/first-time-setup.md index 94c50d7..4723f18 100644 --- a/skills/baoyu-post-to-wechat/references/config/first-time-setup.md +++ b/skills/baoyu-post-to-wechat/references/config/first-time-setup.md @@ -49,14 +49,34 @@ header: "Theme" question: "Default theme for article conversion?" options: - label: "default (Recommended)" - description: "Classic layout - centered title with border, white-on-color H2" + description: "Classic layout - centered title with border, white-on-color H2 (default: blue)" - label: "grace" - description: "Elegant - text shadows, rounded cards, refined blockquotes" + description: "Elegant - text shadows, rounded cards, refined blockquotes (default: purple)" - label: "simple" - description: "Minimal modern - asymmetric rounded corners, clean whitespace" + description: "Minimal modern - asymmetric rounded corners, clean whitespace (default: green)" + - label: "modern" + description: "Large rounded corners, pill headings, spacious (default: orange)" ``` -### Question 2: Default Publishing Method +### Question 2: Default Color + +```yaml +header: "Color" +question: "Default color preset? (theme default if not set)" +options: + - label: "Theme default (Recommended)" + description: "Use the theme's built-in default color" + - label: "blue" + description: "#0F4C81 经典蓝" + - label: "red" + description: "#A93226 中国红" + - label: "green" + description: "#009874 翡翠绿" +``` + +Note: User can choose "Other" to type any preset name (vermilion, yellow, purple, sky, rose, olive, black, gray, pink, orange) or hex value. + +### Question 3: Default Publishing Method ```yaml header: "Method" @@ -68,7 +88,7 @@ options: description: "Slow, requires Chrome and login session" ``` -### Question 3: Default Author +### Question 4: Default Author ```yaml header: "Author" @@ -80,7 +100,7 @@ options: Note: User will likely choose "Other" to type their author name. -### Question 4: Open Comments +### Question 5: Open Comments ```yaml header: "Comments" @@ -92,7 +112,7 @@ options: description: "Disable comments by default" ``` -### Question 5: Fans-Only Comments +### Question 6: Fans-Only Comments ```yaml header: "Fans only" @@ -104,7 +124,7 @@ options: description: "Only followers can comment" ``` -### Question 6: Save Location +### Question 7: Save Location ```yaml header: "Save" @@ -133,7 +153,8 @@ options: ## EXTEND.md Template ```md -default_theme: [default/grace/simple] +default_theme: [default/grace/simple/modern] +default_color: [preset name, hex, or empty for theme default] default_publish_method: [api/browser] default_author: [author name or empty] need_open_comment: [1/0] diff --git a/skills/baoyu-post-to-wechat/scripts/wechat-article.ts b/skills/baoyu-post-to-wechat/scripts/wechat-article.ts index 0c8d211..928350f 100644 --- a/skills/baoyu-post-to-wechat/scripts/wechat-article.ts +++ b/skills/baoyu-post-to-wechat/scripts/wechat-article.ts @@ -673,8 +673,8 @@ Options: --content Article content (use with --image) --html HTML file to paste (alternative to --content) --markdown Markdown file to convert and post (recommended) - --theme Theme for markdown (default, grace, simple) - --author Author name (default: 宝玉) + --theme Theme for markdown (default, grace, simple, modern) + --author Author name --summary Article summary --image Content image, can repeat (only with --content) --submit Save as draft