feat(baoyu-post-to-wechat): add default color preference and modern theme support

This commit is contained in:
Jim Liu 宝玉
2026-02-28 11:48:59 -06:00
parent 7133d54f04
commit 6e18725906
4 changed files with 52 additions and 19 deletions
+18 -6
View File
@@ -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 │ │ 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) 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 ```md
default_theme: default default_theme: default
default_color: blue
default_publish_method: api default_publish_method: api
default_author: 宝玉 default_author: 宝玉
need_open_comment: 1 need_open_comment: 1
@@ -71,6 +72,10 @@ only_fans_can_comment: 0
chrome_profile_path: /path/to/chrome/profile 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**: **Value priority**:
1. CLI arguments 1. CLI arguments
2. Frontmatter 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. **CRITICAL**: If not found, complete first-time setup BEFORE any other steps or questions.
Resolve and store these defaults for later steps: Resolve and store these defaults for later steps:
- `default_theme` (default `default`)
- `default_color` (omit if not set — theme default applies)
- `default_author` - `default_author`
- `need_open_comment` (default `1`) - `need_open_comment` (default `1`)
- `only_fans_can_comment` (default `0`) - `only_fans_can_comment` (default `0`)
@@ -201,13 +208,18 @@ B) Continue - provide HTML file manually
- EXTEND.md `default_theme` (loaded in Step 0) - EXTEND.md `default_theme` (loaded in Step 0)
- Fallback: `default` - 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 ```bash
npx -y bun ${MD_TO_HTML_SKILL_DIR}/scripts/main.ts <markdown_file> --theme <theme> npx -y bun ${MD_TO_HTML_SKILL_DIR}/scripts/main.ts <markdown_file> --theme <theme> [--color <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` 3. **Parse JSON output** to get: `htmlPath`, `title`, `author`, `summary`, `contentImages`
@@ -307,7 +319,7 @@ WeChat Publishing Complete!
Input: [type] - [path] Input: [type] - [path]
Method: API Method: API
Theme: [theme name] Theme: [theme name] [color if set]
Article: Article:
• Title: [title] • Title: [title]
@@ -334,7 +346,7 @@ WeChat Publishing Complete!
Input: [type] - [path] Input: [type] - [path]
Method: Browser Method: Browser
Theme: [theme name] Theme: [theme name] [color if set]
Article: Article:
• Title: [title] • Title: [title]
@@ -20,9 +20,9 @@ npx -y bun ./scripts/wechat-article.ts --markdown article.md --author "作者名
| Parameter | Description | | Parameter | Description |
|-----------|-------------| |-----------|-------------|
| `--markdown <path>` | Markdown file to convert and post | | `--markdown <path>` | Markdown file to convert and post |
| `--theme <name>` | Theme: default, grace, or simple | | `--theme <name>` | Theme: default, grace, simple, modern |
| `--title <text>` | Override title (auto-extracted from markdown) | | `--title <text>` | Override title (auto-extracted from markdown) |
| `--author <name>` | Author name (default: 宝玉) | | `--author <name>` | Author name |
| `--summary <text>` | Article summary | | `--summary <text>` | Article summary |
| `--html <path>` | Pre-rendered HTML file (alternative to markdown) | | `--html <path>` | Pre-rendered HTML file (alternative to markdown) |
| `--profile <dir>` | Chrome profile directory | | `--profile <dir>` | Chrome profile directory |
@@ -49,14 +49,34 @@ header: "Theme"
question: "Default theme for article conversion?" question: "Default theme for article conversion?"
options: options:
- label: "default (Recommended)" - 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" - label: "grace"
description: "Elegant - text shadows, rounded cards, refined blockquotes" description: "Elegant - text shadows, rounded cards, refined blockquotes (default: purple)"
- label: "simple" - 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 ```yaml
header: "Method" header: "Method"
@@ -68,7 +88,7 @@ options:
description: "Slow, requires Chrome and login session" description: "Slow, requires Chrome and login session"
``` ```
### Question 3: Default Author ### Question 4: Default Author
```yaml ```yaml
header: "Author" header: "Author"
@@ -80,7 +100,7 @@ options:
Note: User will likely choose "Other" to type their author name. Note: User will likely choose "Other" to type their author name.
### Question 4: Open Comments ### Question 5: Open Comments
```yaml ```yaml
header: "Comments" header: "Comments"
@@ -92,7 +112,7 @@ options:
description: "Disable comments by default" description: "Disable comments by default"
``` ```
### Question 5: Fans-Only Comments ### Question 6: Fans-Only Comments
```yaml ```yaml
header: "Fans only" header: "Fans only"
@@ -104,7 +124,7 @@ options:
description: "Only followers can comment" description: "Only followers can comment"
``` ```
### Question 6: Save Location ### Question 7: Save Location
```yaml ```yaml
header: "Save" header: "Save"
@@ -133,7 +153,8 @@ options:
## EXTEND.md Template ## EXTEND.md Template
```md ```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_publish_method: [api/browser]
default_author: [author name or empty] default_author: [author name or empty]
need_open_comment: [1/0] need_open_comment: [1/0]
@@ -673,8 +673,8 @@ Options:
--content <text> Article content (use with --image) --content <text> Article content (use with --image)
--html <path> HTML file to paste (alternative to --content) --html <path> HTML file to paste (alternative to --content)
--markdown <path> Markdown file to convert and post (recommended) --markdown <path> Markdown file to convert and post (recommended)
--theme <name> Theme for markdown (default, grace, simple) --theme <name> Theme for markdown (default, grace, simple, modern)
--author <name> Author name (default: 宝玉) --author <name> Author name
--summary <text> Article summary --summary <text> Article summary
--image <path> Content image, can repeat (only with --content) --image <path> Content image, can repeat (only with --content)
--submit Save as draft --submit Save as draft