WeChat Theme Extractor
Overview
Extract layout and style signals from a WeChat Official Account article, then generate a reusable theme for markdown-wechat-converter. The workflow derives typography, colors, spacing, and block styles from the article, writes the generated theme into markdown-to-wechat.html, and supports previewing the result.
When to Use
Use this skill when the user:
- Provides a
mp.weixin.qq.com article URL
- Wants to extract typography, color, spacing, and block styles from a WeChat article
- Wants a new theme generated for
markdown-wechat-converter
- Wants the theme written into
markdown-to-wechat.html and previewed
Do not use
Do not use this skill when:
- The URL is not a WeChat Official Account article
- The user only wants article text extraction without theme analysis
- The target project does not contain
markdown-wechat-converter or markdown-to-wechat.html
Instructions
- Run
scripts/extract.py to fetch the article HTML and extract the title and js_content.
- Read
.extracted_content.html and analyze style traits directly from the HTML.
- Generate a theme object compatible with
markdown-wechat-converter.
- Locate
markdown-to-wechat.html in the current workspace and inject the new theme without breaking existing theme definitions.
- Re-open the file and verify the theme entry was actually written.
- If verification succeeds, open
markdown-to-wechat.html in the browser for preview.
Workflow
User provides URL
-> run extractor script
-> produce .extracted_content.html
-> analyze styles
-> generate theme config
-> write into markdown-to-wechat.html
-> verify write result
-> open preview
Run the script
python3 scripts/extract.py "https://mp.weixin.qq.com/s/xxxxx"
Script responsibilities
The Python script only:
- Fetches article HTML
- Extracts the article title
- Extracts the
js_content body fragment
- Saves the result to
.extracted_content.html
The AI handles:
- Style analysis
- Theme generation
- Config injection
- Post-write verification
- Preview opening
Injection rules for markdown-to-wechat.html
When updating markdown-to-wechat.html, follow these rules:
Find the real theme source first.
- Search for theme-related objects, arrays, maps, or
const assignments before editing.
- Do not assume a fixed variable name unless it exists in the file.
Preserve the existing structure.
- Match the file's current object style, quote style, indentation, and trailing comma convention.
- Do not reformat unrelated sections.
Add, do not overwrite blindly.
- If the new theme name does not exist, append a new entry in the existing theme collection.
- If the same theme name already exists, update only that entry instead of duplicating it.
Keep the change scoped.
- Only touch the theme definition block and any minimal registration hook required to make the theme selectable.
- Do not modify renderer logic, event handlers, or unrelated UI code unless the file structure requires a minimal wiring change.
Verify after writing.
- Re-read the edited section and confirm the theme key, title, and core style properties are present.
- If the theme block cannot be located safely, stop and report that the target file structure needs manual confirmation.
Example theme snippet
Generate a theme object that matches the target file's existing structure. Use this as a minimal reference shape:
{
id: "wechat-clean-blue",
name: "WeChat Clean Blue",
styles: {
body: {
fontFamily: "\"PingFang SC\", \"Helvetica Neue\", sans-serif",
fontSize: "16px",
color: "#2b2b2b",
lineHeight: "1.75",
backgroundColor: "#ffffff"
},
h1: {
fontSize: "24px",
fontWeight: "700",
textAlign: "center",
color: "#1f3a5f"
},
h2: {
fontSize: "20px",
fontWeight: "700",
color: "#1f3a5f",
borderBottom: "2px solid #9ec1ff"
},
blockquote: {
color: "#4a5568",
backgroundColor: "#f7fbff",
borderLeft: "4px solid #7fb3ff",
padding: "12px 16px"
}
}
}
When writing:
- Match the real field names used in
markdown-to-wechat.html
- Convert this shape if the target file uses arrays, maps, or nested registration
- Include at minimum the theme key, display name, and core typography styles
Output file
scripts/.extracted_content.html: extracted article body HTML with title and source URL comments at the top
Validation checklist
- The article HTML was fetched successfully
.extracted_content.html exists and is not empty
- The title and
js_content were extracted
- The new theme entry exists in
markdown-to-wechat.html
- The preview page opens successfully
1---2name: wechat-theme-extractor3description: Use when extracting visual styles from a WeChat article and generating a markdown-wechat-converter theme.4---5
6# WeChat Theme Extractor
7
8## Overview
9
10Extract layout and style signals from a WeChat Official Account article, then generate a reusable theme for `markdown-wechat-converter`. The workflow derives typography, colors, spacing, and block styles from the article, writes the generated theme into `markdown-to-wechat.html`, and supports previewing the result.
11
12## When to Use
13
14Use this skill when the user:
15- Provides a `mp.weixin.qq.com` article URL
16- Wants to extract typography, color, spacing, and block styles from a WeChat article
17- Wants a new theme generated for `markdown-wechat-converter`
18- Wants the theme written into `markdown-to-wechat.html` and previewed
19
20## Do not use
21
22Do not use this skill when:
23- The URL is not a WeChat Official Account article
24- The user only wants article text extraction without theme analysis
25- The target project does not contain `markdown-wechat-converter` or `markdown-to-wechat.html`
26
27## Instructions
28
291. Run `scripts/extract.py` to fetch the article HTML and extract the title and `js_content`.
302. Read `.extracted_content.html` and analyze style traits directly from the HTML.
313. Generate a theme object compatible with `markdown-wechat-converter`.
324. Locate `markdown-to-wechat.html` in the current workspace and inject the new theme without breaking existing theme definitions.
335. Re-open the file and verify the theme entry was actually written.
346. If verification succeeds, open `markdown-to-wechat.html` in the browser for preview.
35
36## Workflow
37
38```text
39User provides URL
40 -> run extractor script
41 -> produce .extracted_content.html
42 -> analyze styles
43 -> generate theme config
44 -> write into markdown-to-wechat.html
45 -> verify write result
46 -> open preview
47```
48
49## Run the script
50
51```bash
52python3 scripts/extract.py "https://mp.weixin.qq.com/s/xxxxx"
53```
54
55## Script responsibilities
56
57The Python script only:
58- Fetches article HTML
59- Extracts the article title
60- Extracts the `js_content` body fragment
61- Saves the result to `.extracted_content.html`
62
63The AI handles:
64- Style analysis
65- Theme generation
66- Config injection
67- Post-write verification
68- Preview opening
69
70## Injection rules for `markdown-to-wechat.html`
71
72When updating `markdown-to-wechat.html`, follow these rules:
73
741. Find the real theme source first.
75 - Search for theme-related objects, arrays, maps, or `const` assignments before editing.
76 - Do not assume a fixed variable name unless it exists in the file.
77
782. Preserve the existing structure.
79 - Match the file's current object style, quote style, indentation, and trailing comma convention.
80 - Do not reformat unrelated sections.
81
823. Add, do not overwrite blindly.
83 - If the new theme name does not exist, append a new entry in the existing theme collection.
84 - If the same theme name already exists, update only that entry instead of duplicating it.
85
864. Keep the change scoped.
87 - Only touch the theme definition block and any minimal registration hook required to make the theme selectable.
88 - Do not modify renderer logic, event handlers, or unrelated UI code unless the file structure requires a minimal wiring change.
89
905. Verify after writing.
91 - Re-read the edited section and confirm the theme key, title, and core style properties are present.
92 - If the theme block cannot be located safely, stop and report that the target file structure needs manual confirmation.
93
94## Example theme snippet
95
96Generate a theme object that matches the target file's existing structure. Use this as a minimal reference shape:
97
98```js
99{
100 id: "wechat-clean-blue",
101 name: "WeChat Clean Blue",
102 styles: {
103 body: {
104 fontFamily: "\"PingFang SC\", \"Helvetica Neue\", sans-serif",
105 fontSize: "16px",
106 color: "#2b2b2b",
107 lineHeight: "1.75",
108 backgroundColor: "#ffffff"
109 },
110 h1: {
111 fontSize: "24px",
112 fontWeight: "700",
113 textAlign: "center",
114 color: "#1f3a5f"
115 },
116 h2: {
117 fontSize: "20px",
118 fontWeight: "700",
119 color: "#1f3a5f",
120 borderBottom: "2px solid #9ec1ff"
121 },
122 blockquote: {
123 color: "#4a5568",
124 backgroundColor: "#f7fbff",
125 borderLeft: "4px solid #7fb3ff",
126 padding: "12px 16px"
127 }
128 }
129}
130```
131
132When writing:
133- Match the real field names used in `markdown-to-wechat.html`
134- Convert this shape if the target file uses arrays, maps, or nested registration
135- Include at minimum the theme key, display name, and core typography styles
136
137## Output file
138
139- `scripts/.extracted_content.html`: extracted article body HTML with title and source URL comments at the top
140
141## Validation checklist
142
143- The article HTML was fetched successfully
144- `.extracted_content.html` exists and is not empty
145- The title and `js_content` were extracted
146- The new theme entry exists in `markdown-to-wechat.html`
147- The preview page opens successfully