mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-13 06:19:46 +08:00
feat(baoyu-post-to-wechat): add default color preference and modern theme support
This commit is contained in:
@@ -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 <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`
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -20,9 +20,9 @@ npx -y bun ./scripts/wechat-article.ts --markdown article.md --author "作者名
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `--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) |
|
||||
| `--author <name>` | Author name (default: 宝玉) |
|
||||
| `--author <name>` | Author name |
|
||||
| `--summary <text>` | Article summary |
|
||||
| `--html <path>` | Pre-rendered HTML file (alternative to markdown) |
|
||||
| `--profile <dir>` | Chrome profile directory |
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -673,8 +673,8 @@ Options:
|
||||
--content <text> Article content (use with --image)
|
||||
--html <path> HTML file to paste (alternative to --content)
|
||||
--markdown <path> Markdown file to convert and post (recommended)
|
||||
--theme <name> Theme for markdown (default, grace, simple)
|
||||
--author <name> Author name (default: 宝玉)
|
||||
--theme <name> Theme for markdown (default, grace, simple, modern)
|
||||
--author <name> Author name
|
||||
--summary <text> Article summary
|
||||
--image <path> Content image, can repeat (only with --content)
|
||||
--submit Save as draft
|
||||
|
||||
Reference in New Issue
Block a user