xiaohongshu-images
Transform markdown/HTML into styled 3:4 ratio images for Xiaohongshu
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Transform markdown/HTML into styled 3:4 ratio images for Xiaohongshu
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | xiaohongshu-images |
| description | Transform markdown/HTML into styled 3:4 ratio images for Xiaohongshu |
This skill transforms markdown, HTML, or text content into beautifully styled HTML pages with AI-generated cover images, then captures them as sequential screenshots at 3:4 ratio for Xiaohongshu posting.
The skill performs the following workflow:
prompts/default.md in this skill's directory/baoyu-cover-image skill to generate a cover image based on the article content~/Dev/obsidian/{account_folder}/articles/<date-title>/xhs-preview.htmlThe skill determines the output account folder using the following priority:
--account ParameterIf the user specifies --account, use the corresponding folder:
/xiaohongshu-images <article> --account james-cn # → 10_在悉尼和稀泥
/xiaohongshu-images <article> --account james-en # → 11_BuildWithJames
/xiaohongshu-images <article> --account mom-reading-club # → 12_妈妈在读
If no --account is specified, try to infer from the input file path:
Input: ~/Dev/obsidian/12_妈妈在读/articles/2026-01-20-xxx/index.md
→ Output to: ~/Dev/obsidian/12_妈妈在读/articles/2026-01-20-xxx/
Input: ~/Dev/obsidian/10_在悉尼和稀泥/articles/2026-01-20-xxx/index.md
→ Output to: ~/Dev/obsidian/10_在悉尼和稀泥/articles/2026-01-20-xxx/
If the account cannot be determined from the path (e.g., raw content input), use template-based mapping:
| Template | Account Folder |
|---|---|
default | 10_在悉尼和稀泥 |
mom-reading-club | 12_妈妈在读 |
| Account | Folder |
|---|---|
james-cn | 10_在悉尼和稀泥 |
james-en | 11_BuildWithJames |
mom-reading-club | 12_妈妈在读 |
When the user invokes this skill, follow these steps:
The user will provide one of the following:
/path/to/article.md)If the input is unclear, ask the user to provide either a file path, URL, or paste the content directly.
Read the prompt template from this skill's directory:
{{SKILL_DIR}}/prompts/default.md
Use the Read tool to get the prompt template content. This template defines the HTML/CSS styling specifications.
From the content, extract:
Create the output folder path as: ~/Dev/obsidian/{account_folder}/articles/<date>-<sanitized-title>/
_attachments/ subfolder⚠️ COMPLIANCE CHECK: Before generating, ensure the image concept complies with Xiaohongshu community guidelines (Section 11 of the prompt template). The image must:
Use the /baoyu-cover-image skill to generate the cover image:
/baoyu-cover-image ~/Dev/obsidian/{account_folder}/articles/<date>-<title>/index.md --style <auto-or-specified> --no-title
Or if the content is not yet saved, pass the content directly to the skill.
Style Selection:
tech - AI, coding, digital topicswarm - Personal stories, emotional contentbold - Controversial, attention-grabbing topicsminimal - Simple, zen-like contentplayful - Fun, casual, beginner-friendly contentnature - Wellness, health, organic topicsretro - History, vintage, traditional topicselegant - Business, professional content (default)Special: Mom Reading Club Template
When using the mom-reading-club template, override the default cover style with calligraphy & ink-wash illustration (书法水墨风):
/baoyu-cover-image <article> --style minimal --no-title --custom-prompt "Chinese calligraphy and ink-wash illustration style (书法水墨风). Zen-like simplicity with generous white space (留白). Include subtle ink-wash brush strokes as background texture. Minimalist botanical elements (bamboo, plum blossoms, orchids, lotus) when appropriate. Color palette: ink black (#1a1a1a), warm gray (#666666), subtle gold accents (#C9A962), warm off-white background (#F5F3EE). If human figures are included, depict an elegant woman aged 30-45 with a contemplative, refined demeanor. NO TEXT on the cover."
Use --no-title flag since Xiaohongshu covers typically use visual-only images without embedded text.
Move the generated image to the correct location:
imgs/cover.png relative to the article~/Dev/obsidian/{account_folder}/articles/<date>-<title>/_attachments/cover-xhs.pngmv ~/Dev/obsidian/{account_folder}/articles/<date>-<title>/imgs/cover.png ~/Dev/obsidian/{account_folder}/articles/<date>-<title>/_attachments/cover-xhs.png
⚠️ COMPLIANCE CHECK: Before generating HTML, review the text content for compliance:
Using the prompt template and the user's content:
Parse the content to identify:
Generate complete HTML following the template specifications:
Important HTML Structure:
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Article Title</title>
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@700&family=Inter:wght@300;400;700;800&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
<style>
/* All CSS styles inline */
</style>
</head>
<body>
<div class="container">
<img src="_attachments/cover-xhs.png" class="cover-image" alt="Cover">
<div class="content">
<!-- Article content -->
</div>
</div>
</body>
</html>
~/Dev/obsidian/{account_folder}/articles/<date>-<title>/xhs-preview.htmlAfter generating the HTML, capture sequential screenshots of the .container element at exact 3:4 aspect ratio:
Screenshot Specifications:
.container element, not the full pageCapture Process:
.container element has overflow-y: auto, making it internally scrollablescrollTop = 0 and increment through the content.container content:
container.screenshot() to capture only the container element (excludes page background)~/Dev/obsidian/{account_folder}/articles/<date>-<title>/_attachments/:
xhs-01.png, xhs-02.png, xhs-03.png, etc.Use the screenshot script:
cd {{SKILL_DIR}} && python scripts/screenshot.py ~/Dev/obsidian/{account_folder}/articles/<date>-<title>/xhs-preview.html
Script Output:
After completion, report to the user:
{{SKILL_DIR}}/
├── SKILL.md # This file
├── prompts/
│ └── default.md # Default HTML/CSS styling prompt
│ └── mom-reading-club.md # Mom Reading Club styling prompt
├── scripts/
│ └── screenshot.py # Screenshot capture script
└── .gitignore
Output directory (outside skill folder):
~/Dev/obsidian/{account_folder}/articles/<date>-<title>/
├── xhs-preview.html # Styled HTML preview page
├── imgs/ # Created by baoyu-cover-image
│ ├── prompts/
│ │ └── cover.md # Cover image prompt
│ └── cover.png # Generated cover (moved to _attachments/)
└── _attachments/ # Obsidian-style attachments folder
├── cover-xhs.png # Cover image (moved from imgs/cover.png)
├── xhs-01.png # Screenshot page 1 (1200×1600)
├── xhs-02.png # Screenshot page 2
└── ...
Account folder mapping:
- james-cn → 10_在悉尼和稀泥
- james-en → 11_BuildWithJames
- mom-reading-club → 12_妈妈在读
This skill depends on:
/baoyu-cover-image skill for cover image generation (must be installed in ~/.claude/skills/)User: Create a styled article page from this markdown:
# My Article Title
This is the introduction paragraph...
## Section 1
Content for section 1...
Assistant Actions:
prompts/default.md10_在悉尼和稀泥)~/Dev/obsidian/10_在悉尼和稀泥/articles/2024-01-14-my-article-title//baoyu-cover-image skill with --no-title flag to generate cover imageimgs/cover.png to _attachments/cover-xhs.png~/Dev/obsidian/10_在悉尼和稀泥/articles/2024-01-14-my-article-title/xhs-preview.html~/Dev/obsidian/10_在悉尼和稀泥/articles/2024-01-14-my-article-title/_attachments/xhs-01.png, etc.Example with --account parameter:
/xiaohongshu-images ~/path/to/article.md --account mom-reading-club --template mom-reading-club
Assistant Actions:
--account mom-reading-club specified → use 12_妈妈在读~/Dev/obsidian/12_妈妈在读/articles/2024-01-14-article-title/Example with path inference:
/xiaohongshu-images ~/Dev/obsidian/12_妈妈在读/articles/2024-01-14-xxx/index.md
Assistant Actions:
12_妈妈在读 → infer account folder~/Dev/obsidian/12_妈妈在读/articles/2024-01-14-xxx/Users can provide custom prompt templates by:
.md file in the prompts/ directoryExample: "Use the xiaohongshu-style template for this article"
| Template | Description | Best For |
|---|---|---|
default | Standard style with New Yorker-style illustrations | General articles |
mom-reading-club | Calligraphy & ink-wash style with TsangerJinKai02 font | Mom Reading Club (妈妈读书会) brand content |
Use this template for all "Mom Reading Club" branded content:
/xiaohongshu-images <article> --template mom-reading-club
Features:
If the /baoyu-cover-image skill fails:
If screenshot capture fails:
This skill requires:
pip install playwright && playwright install chromium)/baoyu-cover-image skill installed in ~/.claude/skills/Install dependencies:
pip install playwright
playwright install chromium
IMPORTANT: All generated content must comply with Xiaohongshu community guidelines.
| Category | Examples | Action |
|---|---|---|
| Absolute claims | 最好、最佳、第一、国家级 | Remove or rephrase |
| Exaggerated effects | 一分钟见效、立刻瘦10斤 | Remove or add disclaimers |
| Medical/Financial advice | Health tips, investment suggestions | Add disclaimer: "本内容不构成医疗/投资建议" |
| Inappropriate imagery | Nudity, violence, political symbols | Regenerate with appropriate content |
| False information | Pseudoscience, unverified claims | Verify or remove |
| Defamatory content | Attacks on brands/individuals | Remove entirely |