xhs-note-creator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese小红书笔记创作技能
Xiaohongshu Note Creation Skill
这个技能用于创建专业的小红书笔记素材,包括内容撰写、图片卡片生成和笔记发布。
This skill is used to create professional Xiaohongshu note materials, including content writing, image card generation, and note publishing.
使用场景
Usage Scenarios
- 用户需要创建小红书笔记时
- 用户提供资料需要转化为小红书风格内容时
- 用户需要生成精美的图片卡片用于发布时
- When users need to create Xiaohongshu notes
- When users need to convert provided materials into Xiaohongshu-style content
- When users need to generate beautiful image cards for publishing
工作流程
Workflow
第一步:撰写小红书笔记内容
Step 1: Write Xiaohongshu Note Content
根据用户需求和提供的资料,创作符合小红书风格的内容:
Create content that fits Xiaohongshu's style based on user needs and provided materials:
标题要求
Title Requirements
- 不超过 20 字
- 吸引眼球,制造好奇心
- 可使用数字、疑问句、感叹号增强吸引力
- 示例:「5个让效率翻倍的神器推荐!」「震惊!原来这样做才对」
- No more than 20 characters
- Eye-catching and curiosity-inducing
- Use numbers, questions, or exclamation marks to enhance appeal
- Examples: "5 Efficiency Tools to Double Your Productivity!", "Shocking! This Is the Right Way to Do It"
正文要求
Body Requirements
- 使用良好的排版,段落清晰
- 点缀少量 Emoji 增加可读性(每段 1-2 个即可)
- 使用简短的句子和段落
- 结尾给出 SEO 友好的 Tags 标签(5-10 个相关标签)
- Use good formatting with clear paragraphs
- Add a small number of emojis to improve readability (1-2 per paragraph)
- Use short sentences and paragraphs
- Include SEO-friendly tags at the end (5-10 relevant tags)
第二步:生成 Markdown 文档
Step 2: Generate Markdown Document
注意:这里生成的 Markdown 文档是用于渲染卡片的,必须专门生成,禁止直接使用上一步的笔记正文内容。
Markdown 文件,文件应包含:
- YAML 头部元数据(封面信息):
yaml
---
emoji: "🚀" # 封面装饰 Emoji
title: "大标题" # 封面大标题(不超过15字)
subtitle: "副标题文案" # 封面副标题(不超过15字)
---- 用于渲染卡片的 Markdown 文本内容:
- 当待渲染内容必须严格切分为独立的数张图片时,可使用 分割线主动将正文分隔为多个卡片段落(每个段落文本控制在 200 字左右),输出图片时使用参数
----m separator - 当待渲染内容无需严格分割,生成正常 Markdown 文本即可,跟下方分页模式参数规则按需选择
- 当待渲染内容必须严格切分为独立的数张图片时,可使用
完整 Markdown 文档内容示例:
markdown
---
emoji: "💡"
title: "5个效率神器让工作效率翻倍"
subtitle: "对着抄作业就好了,一起变高效"
---Note: The Markdown document generated here is for rendering cards and must be created specifically. Do not directly use the note content from the previous step.
The Markdown file should include:
- YAML front matter (cover information):
yaml
---
emoji: "🚀" # Cover decorative emoji
title: "Main Title" # Cover main title (no more than 15 characters)
subtitle: "Subtitle Copy" # Cover subtitle (no more than 15 characters)
---- Markdown text content for rendering cards:
- When the content to be rendered must be strictly split into separate images, use the separator to actively divide the body into multiple card paragraphs (control each paragraph to around 200 characters), and use the parameter
---when outputting images-m separator - When the content to be rendered does not require strict splitting, generate normal Markdown text and select pagination mode parameters as needed
- When the content to be rendered must be strictly split into separate images, use the
Example of a complete Markdown document:
markdown
---
emoji: "💡"
title: "5 Efficiency Tools to Boost Work Productivity"
subtitle: "Just copy this and become more efficient together"
---📝 神器一:Notion
📝 Tool 1: Notion
全能型笔记工具,支持数据库、看板、日历等多种视图...
All-in-one note-taking tool that supports multiple views like databases, kanban boards, calendars...
特色功能
Key Features
- 特色一
- 特色二
- Feature 1
- Feature 2
⚡ 神器二:Raycast
⚡ Tool 2: Raycast
```
可使用代码块来增加渲染后图片的视觉丰富度
```
Use code blocks to enhance the visual richness of rendered images推荐原因
Reasons for Recommendation
- 原因一
- 原因二
- ……
- Reason 1
- Reason 2
- ……
🌈 神器三:Arc
🌈 Tool 3: Arc
全新理念的浏览器,侧边栏标签管理...
...
undefinedA browser with a new concept, featuring sidebar tab management...
...
undefined第三步:渲染图片卡片
Step 3: Render Image Cards
将 Markdown 文档渲染为图片卡片。使用以下脚本渲染:
bash
python scripts/render_xhs.py <markdown_file> [options]- 默认输出目录为当前工作目录
- 生成的图片包括:封面(cover.png)和正文卡片(card_1.png, card_2.png, ...)
Render the Markdown document into image cards. Use the following script for rendering:
bash
python scripts/render_xhs.py <markdown_file> [options]- Default output directory is the current working directory
- Generated images include: cover (cover.png) and body cards (card_1.png, card_2.png, ...)
渲染参数(Python)
Rendering Parameters (Python)
| 参数 | 简写 | 说明 | 默认值 |
|---|---|---|---|
| | 输出目录 | 当前工作目录 |
| | 排版主题 | |
| | 分页模式 | |
| | 图片宽度 | |
| 图片高度( | | |
| | | |
| 设备像素比(清晰度) | |
| Parameter | Short Form | Description | Default Value |
|---|---|---|---|
| | Output directory | Current working directory |
| | Layout theme | |
| | Pagination mode | |
| | Image width | |
| Image height (minimum height in | | |
| Maximum height in | | |
| Device pixel ratio (clarity) | |
排版主题(--theme
)
--themeLayout Themes (--theme
)
--theme- :默认简约浅灰渐变背景(
default)#f3f3f3 -> #f9f9f9 - :活泼几何(Memphis)
playful-geometric - :新粗野主义
neo-brutalism - :植物园自然
botanical - :专业商务
professional - :复古怀旧
retro - :终端命令行
terminal - :手绘素描
sketch
- : Default minimalist light gray gradient background (
default)#f3f3f3 -> #f9f9f9 - : Playful geometric (Memphis) style
playful-geometric - : Neo-brutalism style
neo-brutalism - : Botanical natural style
botanical - : Professional business style
professional - : Retro nostalgic style
retro - : Terminal command line style
terminal - : Hand-drawn sketch style
sketch
分页模式(--mode
)
--modePagination Modes (--mode
)
--mode- :按
separator分隔符分页(适合内容已手动控量)--- - :固定尺寸下自动缩放文字,避免溢出/留白(适合封面+单张图片但尺寸固定的情况)
auto-fit - :按渲染后高度自动切分分页(适合切分不影响阅读的长文内容)
auto-split - :根据内容动态调整图片高度(注意:图片最高 4320,字数超过 550 的不建使用此模式)
dynamic
- : Paginate by
separatorseparators (suitable for content with manually controlled volume)--- - : Automatically scale text within fixed dimensions to avoid overflow/blank space (suitable for cover + single image with fixed dimensions)
auto-fit - : Automatically split pages based on rendered height (suitable for long content where splitting does not affect reading)
auto-split - : Dynamically adjust image height based on content (Note: Maximum image height is 4320, not recommended for content with over 550 characters)
dynamic
常用示例
Common Examples
bash
undefinedbash
undefined1) 默认主题 + 手动分隔分页
1) Default theme + manual separator pagination
python scripts/render_xhs.py content.md -m separator
python scripts/render_xhs.py content.md -m separator
2) 固定 1080x1440,自动缩放文字,尽量填满画面
2) Fixed 1080x1440, auto-scale text to fill the screen as much as possible
python scripts/render_xhs.py content.md -m auto-fit
python scripts/render_xhs.py content.md -m auto-fit
3) 自动切分分页(推荐:内容长短不稳定)
3) Auto-split pagination (Recommended: for content with unstable length)
python scripts/render_xhs.py content.md -m auto-split
python scripts/render_xhs.py content.md -m auto-split
4) 动态高度(允许不同高度卡片)
4) Dynamic height (Allows cards of different heights)
python scripts/render_xhs.py content.md -m dynamic --max-height 4320
python scripts/render_xhs.py content.md -m dynamic --max-height 4320
5) 切换主题
5) Switch theme
python scripts/render_xhs.py content.md -t playful-geometric -m auto-split
undefinedpython scripts/render_xhs.py content.md -t playful-geometric -m auto-split
undefinedNode.js 渲染(可选)
Node.js Rendering (Optional)
bash
node scripts/render_xhs.js content.md -t default -m separatorNode.js 参数与 Python 基本一致:、、、、、、。
--output-dir/-o--theme/-t--mode/-m--width/-w--height--max-height--dprbash
node scripts/render_xhs.js content.md -t default -m separatorNode.js parameters are basically the same as Python: , , , , , , .
--output-dir/-o--theme/-t--mode/-m--width/-w--height--max-height--dpr第四步:发布小红书笔记(可选)
Step 4: Publish Xiaohongshu Notes (Optional)
使用发布脚本将生成的图片发布到小红书:
bash
python scripts/publish_xhs.py --title "笔记标题" --desc "笔记描述" --images card_1.png card_2.png cover.png前置条件:
- 需配置小红书 Cookie:
XHS_COOKIE=your_cookie_string_here- Cookie 获取方式:
- 在浏览器中登录小红书(https://www.xiaohongshu.com)
- 打开开发者工具(F12)
- 在 Network 标签中查看请求头的 Cookie
Use the publishing script to publish the generated images to Xiaohongshu:
bash
python scripts/publish_xhs.py --title "Note Title" --desc "Note Description" --images card_1.png card_2.png cover.pngPrerequisites:
- Configure Xiaohongshu Cookie:
XHS_COOKIE=your_cookie_string_here- How to obtain Cookie:
- Log in to Xiaohongshu (https://www.xiaohongshu.com) in your browser
- Open Developer Tools (F12)
- Check the Cookie in the request header under the Network tab
图片规格说明
Image Specifications
封面卡片
Cover Card
- 尺寸比例:3:4(小红书推荐比例)
- 基准尺寸:1080×1440px
- 包含:Emoji 装饰、大标题、副标题
- 样式:渐变背景 + 圆角内容区
- Aspect ratio: 3:4 (Xiaohongshu recommended ratio)
- Base size: 1080×1440px
- Includes: Emoji decoration, main title, subtitle
- Style: Gradient background + rounded content area
正文卡片
Body Card
- 尺寸比例:3:4
- 基准尺寸:1080×1440px
- 支持:标题、段落、列表、引用、代码块、图片
- 样式:白色卡片 + 渐变背景边框
- Aspect ratio: 3:4
- Base size: 1080×1440px
- Supports: Titles, paragraphs, lists, quotes, code blocks, images
- Style: White card + gradient background border
技能资源
Skill Resources
脚本文件
Script Files
- - Python 渲染脚本
scripts/render_xhs.py - - Node.js 渲染脚本
scripts/render_xhs.js - - 小红书发布脚本
scripts/publish_xhs.py
- - Python rendering script
scripts/render_xhs.py - - Node.js rendering script
scripts/render_xhs.js - - Xiaohongshu publishing script
scripts/publish_xhs.py
资源文件
Resource Files
- - 封面 HTML 模板
assets/cover.html - - 正文卡片 HTML 模板
assets/card.html - - 共用样式表
assets/styles.css
- - Cover HTML template
assets/cover.html - - Body card HTML template
assets/card.html - - Shared stylesheet
assets/styles.css
注意事项
Notes
- Markdown 文件应保存在工作目录,渲染后的图片也保存在工作目录
- 技能目录 () 仅存放脚本和模板,不存放用户数据
md2Redbook/ - 图片尺寸会根据内容自动调整,但保持 3:4 比例
- Cookie 有有效期限制,过期后需要重新获取
- 发布功能依赖 xhs 库,需要安装:
pip install xhs
- Markdown files should be saved in the working directory, and rendered images are also saved in the working directory
- The skill directory () only stores scripts and templates, not user data
md2Redbook/ - Image dimensions will be automatically adjusted based on content, but maintain a 3:4 aspect ratio
- Cookies have an expiration date; you need to re-obtain them after expiration
- The publishing function depends on the xhs library, which needs to be installed:
pip install xhs