SuperAPI AI Directory

xhs-note-creator

General & other

View repository

Updated 10-16 01:26

About this skill

Xiaohongshu Note Creation Skill

This skill is used to create professional Xiaohongshu note materials, including content writing, image card generation, and note publishing.

Use Cases

  • When users need to create Xiaohongshu notes
  • When user-provided materials need to be transformed into Xiaohongshu-style content
  • When users need to generate beautifully designed image cards for publishing

Workflow

Step 1: Write Xiaohongshu note content

Based on user needs and provided materials, create content that matches the Xiaohongshu style:

Title Requirements

  • No more than 20 characters
  • Eye-catching and curiosity-inducing
  • Can use numbers, questions, and exclamation marks to enhance appeal
  • Examples: "5 Artifacts That Double Your Efficiency!" "Shocking! So This Is How It Should Be Done"

Body Requirements

  • Use good formatting with clear paragraphs
  • Add a small amount of Emoji to increase readability (1-2 per paragraph is enough)
  • Use short sentences and paragraphs
  • Provide SEO-friendly Tags at the end (5-10 related tags)

Step 2: Generate a Markdown document

Note: The Markdown document generated here is used to render cards and must be generated separately; do not directly use the note body content from the previous step.

Markdown file, the file should include:

  1. YAML header metadata (cover information):
---
emoji: "🚀"           # 封面装饰 Emoji
title: "大标题"        # 封面大标题(不超过15字)
subtitle: "副标题文案"  # 封面副标题(不超过15字)
---
  1. Markdown text content used to render cards:
    • When the content to be rendered must be strictly divided into several independent images, you can use --- dividers to actively separate the body into multiple card paragraphs (keep each paragraph at around 200 characters); when outputting images, use the parameter-m separator
    • When the content to be rendered does not need strict division, simply generate normal Markdown text, and choose as needed according to the pagination mode parameter rules below

Complete Markdown document content example:

---
emoji: "💡"
title: "5个效率神器让工作效率翻倍"
subtitle: "对着抄作业就好了,一起变高效"
---

# 📝 神器一:Notion

> 全能型笔记工具,支持数据库、看板、日历等多种视图...

## 特色功能

- 特色一
- 特色二

# ⚡ 神器二:Raycast

\`\`\`
可使用代码块来增加渲染后图片的视觉丰富度
\`\`\`

## 推荐原因

- 原因一
- 原因二
- ……


# 🌈 神器三:Arc

全新理念的浏览器,侧边栏标签管理...

...

Step 3: Render image cards

Render the Markdown document into image cards. Use the following script to render:

python scripts/render_xhs.py <markdown_file> [options]
  • The default output directory is the current working directory
  • The generated images include: cover (cover.png) and body cards (card_1.png, card_2.png, ...)

Rendering Parameters (Python)

Parameter Abbreviation Description Default Value
--output-dir -o Output Directory Current working directory
--theme -t Layout Theme default
--mode -m Pagination Mode separator
--width -w Image Width 1080
--height Image Height (dynamic is minimum height) 1440
--max-height dynamic Maximum height 4320
--dpr Device Pixel Ratio (clarity) 2

Layout Theme (--theme)

  • default: default minimalist light gray gradient background (#f3f3f3 -> #f9f9f9)
  • playful-geometric: lively geometric (Memphis)
  • neo-brutalism: neo-brutalism
  • botanical: botanical garden nature
  • professional: professional business
  • retro: retro nostalgia
  • terminal: terminal command line
  • sketch: hand-drawn sketch

Pagination mode (--mode)

  • separator: by --- separator pagination (suitable when content volume is already manually controlled)
  • auto-fit: automatically scale text at a fixed size to avoid overflow/blank space (suitable for cover + single image with fixed size)
  • auto-split: automatically split pagination by rendered height (suitable for long-form content where splitting does not affect reading)
  • dynamic: dynamically adjust image height based on content (note: maximum image height is 4320; not recommended when word count exceeds 550)

Common examples

# 1) 默认主题 + 手动分隔分页
python scripts/render_xhs.py content.md -m separator

# 2) 固定 1080x1440,自动缩放文字,尽量填满画面
python scripts/render_xhs.py content.md -m auto-fit

# 3) 自动切分分页(推荐:内容长短不稳定)
python scripts/render_xhs.py content.md -m auto-split

# 4) 动态高度(允许不同高度卡片)
python scripts/render_xhs.py content.md -m dynamic --max-height 4320

# 5) 切换主题
python scripts/render_xhs.py content.md -t playful-geometric -m auto-split

Node.js rendering (optional)

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 note (optional)

Use the publishing script to publish the generated images to Xiaohongshu:

python scripts/publish_xhs.py --title "笔记标题" --desc "笔记描述" --images card_1.png card_2.png cover.png

Prerequisites:

  1. Xiaohongshu Cookie must be configured:
XHS_COOKIE=your_cookie_string_here
  1. How to obtain the Cookie:
    • Log in to Xiaohongshu in the browser (https://www.xiaohongshu.com)
    • Open developer tools (F12)
    • View the Cookie in the request headers under the Network tab

Image specifications

Cover card

  • Aspect ratio: 3:4 (recommended ratio for Xiaohongshu)
  • Base size: 1080×1440px
  • Includes: Emoji decorations, main title, subtitle
  • Style: gradient background + rounded content area

Body card

  • 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 rendering script
  • scripts/render_xhs.js - Node.js rendering script
  • scripts/publish_xhs.py - Xiaohongshu publishing script

Resource files

  • assets/cover.html - Cover HTML template
  • assets/card.html - Body card HTML template
  • assets/styles.css - Shared stylesheet

Notes

  1. Markdown files should be saved in the working directory, and rendered images should also be saved in the working directory
  2. Skill directory (md2Redbook/) only stores scripts and templates, not user data
  3. Image size will automatically adjust based on content, but maintains a 3:4 ratio
  4. Cookies have an expiration limit and need to be re-obtained after expiration
  5. The publishing feature depends on the xhs library, which needs to be installed:pip install xhs