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 文件,文件应包含:
  1. YAML 头部元数据(封面信息):
yaml
---
emoji: "🚀"           # 封面装饰 Emoji
title: "大标题"        # 封面大标题(不超过15字)
subtitle: "副标题文案"  # 封面副标题(不超过15字)
---
  1. 用于渲染卡片的 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:
  1. 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)
---
  1. 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
      -m separator
      when outputting images
    • When the content to be rendered does not require strict splitting, generate normal Markdown text and select pagination mode parameters as needed
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

全新理念的浏览器,侧边栏标签管理...
...
undefined
A 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)

参数简写说明默认值
--output-dir
-o
输出目录当前工作目录
--theme
-t
排版主题
default
--mode
-m
分页模式
separator
--width
-w
图片宽度
1080
--height
图片高度(
dynamic
下为最小高度)
1440
--max-height
dynamic
最大高度
4320
--dpr
设备像素比(清晰度)
2
ParameterShort FormDescriptionDefault Value
--output-dir
-o
Output directoryCurrent working directory
--theme
-t
Layout theme
default
--mode
-m
Pagination mode
separator
--width
-w
Image width
1080
--height
Image height (minimum height in
dynamic
mode)
1440
--max-height
Maximum height in
dynamic
mode
4320
--dpr
Device pixel ratio (clarity)
2

排版主题(
--theme

Layout Themes (
--theme
)

  • default
    :默认简约浅灰渐变背景(
    #f3f3f3 -> #f9f9f9
  • playful-geometric
    :活泼几何(Memphis)
  • neo-brutalism
    :新粗野主义
  • botanical
    :植物园自然
  • professional
    :专业商务
  • retro
    :复古怀旧
  • terminal
    :终端命令行
  • sketch
    :手绘素描
  • default
    : Default minimalist light gray gradient background (
    #f3f3f3 -> #f9f9f9
    )
  • playful-geometric
    : Playful geometric (Memphis) style
  • neo-brutalism
    : Neo-brutalism style
  • botanical
    : Botanical natural style
  • professional
    : Professional business style
  • retro
    : Retro nostalgic style
  • terminal
    : Terminal command line style
  • sketch
    : Hand-drawn sketch style

分页模式(
--mode

Pagination Modes (
--mode
)

  • separator
    :按
    ---
    分隔符分页(适合内容已手动控量)
  • auto-fit
    :固定尺寸下自动缩放文字,避免溢出/留白(适合封面+单张图片但尺寸固定的情况)
  • auto-split
    :按渲染后高度自动切分分页(适合切分不影响阅读的长文内容)
  • dynamic
    :根据内容动态调整图片高度(注意:图片最高 4320,字数超过 550 的不建使用此模式)
  • separator
    : Paginate by
    ---
    separators (suitable for content with manually controlled volume)
  • auto-fit
    : Automatically scale text within fixed dimensions to avoid overflow/blank space (suitable for cover + single image with fixed dimensions)
  • auto-split
    : Automatically split pages based on rendered height (suitable for long content where splitting does not affect reading)
  • dynamic
    : Dynamically adjust image height based on content (Note: Maximum image height is 4320, not recommended for content with over 550 characters)

常用示例

Common Examples

bash
undefined
bash
undefined

1) 默认主题 + 手动分隔分页

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
undefined
python scripts/render_xhs.py content.md -t playful-geometric -m auto-split
undefined

Node.js 渲染(可选)

Node.js Rendering (Optional)

bash
node scripts/render_xhs.js content.md -t default -m separator
Node.js 参数与 Python 基本一致:
--output-dir/-o
--theme/-t
--mode/-m
--width/-w
--height
--max-height
--dpr
bash
node scripts/render_xhs.js content.md -t default -m separator
Node.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
前置条件
  1. 需配置小红书 Cookie:
XHS_COOKIE=your_cookie_string_here
  1. 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.png
Prerequisites:
  1. Configure Xiaohongshu Cookie:
XHS_COOKIE=your_cookie_string_here
  1. 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

  • scripts/render_xhs.py
    - Python 渲染脚本
  • scripts/render_xhs.js
    - Node.js 渲染脚本
  • scripts/publish_xhs.py
    - 小红书发布脚本
  • scripts/render_xhs.py
    - Python rendering script
  • scripts/render_xhs.js
    - Node.js rendering script
  • scripts/publish_xhs.py
    - Xiaohongshu publishing script

资源文件

Resource Files

  • assets/cover.html
    - 封面 HTML 模板
  • assets/card.html
    - 正文卡片 HTML 模板
  • assets/styles.css
    - 共用样式表
  • assets/cover.html
    - Cover HTML template
  • assets/card.html
    - Body card HTML template
  • assets/styles.css
    - Shared stylesheet

注意事项

Notes

  1. Markdown 文件应保存在工作目录,渲染后的图片也保存在工作目录
  2. 技能目录 (
    md2Redbook/
    ) 仅存放脚本和模板,不存放用户数据
  3. 图片尺寸会根据内容自动调整,但保持 3:4 比例
  4. Cookie 有有效期限制,过期后需要重新获取
  5. 发布功能依赖 xhs 库,需要安装:
    pip install xhs
  1. Markdown files should be saved in the working directory, and rendered images are also saved in the working directory
  2. The skill directory (
    md2Redbook/
    ) only stores scripts and templates, not user data
  3. Image dimensions will be automatically adjusted based on content, but maintain a 3:4 aspect ratio
  4. Cookies have an expiration date; you need to re-obtain them after expiration
  5. The publishing function depends on the xhs library, which needs to be installed:
    pip install xhs