Skip to main content

Xiaohongshu Card Export

@ aquarius-wing1412026.7.10xiaohongshu-card-publish

Turn a Xiaohongshu draft into finished 1080×1440 cards — one pipeline covering template fill, series layout, and playwright lossless WebP export.

FeaturedContent

Basic info

Name
Xiaohongshu Card Export
Description
把一篇小红书文案变成可发布的 1080×1440 成品配图——用本 skill 自带的卡片模板填充、 组织系列预览、再用 playwright 导出无损 WebP。当用户给一段小红书文案说 「根据这份文档生成预览」「生成卡片」「做成小红书配图」「排成一组卡片」,或对某系列说 「导出」「截图」「按尺寸出图」「批量出图」时,使用这个 skill。 不要用于:改卡片模板本身的版式/CSS 或新增模板主题、定义文案输入格式或分页规则等数据建模、 选型构建工具链、与本仓库无关的通用 HTML 或截图任务。

Xiaohongshu Card Export

Turn a Xiaohongshu draft into finished 1080×1440 cards — one pipeline covering template fill, series layout, and playwright lossless WebP export.

When to use it

Preview from text:

I paste a Xiaohongshu draft and say "generate a preview from this doc" — I want the skill to fill the template, create the card folder, and update pages.json.

Start a new series:

I have several drafts to arrange as one Xiaohongshu series — pick a series slug, produce one preview card at a time, order tracked in pages.json.

Add one card:

An existing series needs one more card at the end — the skill only adds the card folder and a new pages.json entry; the series shell and other cards stay untouched.

Export a finished series:

I say "export" / "screenshot" / "cut to size" — the skill runs playwright and drops 1080×1440 lossless WebPs into dist/<series>/snapshot/.

Export several series:

Several series exported in one call, each respecting its own pages.json order.

Not in scope:

Editing the card template layout / CSS / adding a new theme → that's editing assets/ itself, done separately; defining the copy input format / paging rules → data modelling, out of scope; generic HTML or screenshot tasks unrelated to this repo → not applicable.

What it produces

By default, no variable is silently filled — a brand name / page number / account / highlight target missing from the copy stops the skill to ask with a proposed value; a made-up placeholder is never quietly used. This is the most counter-intuitive part.

  • Card output: dist/<series>/<card-name>/index.html, copied from assets/default.html and filled at every {{variable}}
  • Series shell: dist/<series>/index.html (copied from assets/app.html) + dist/<series>/pages.json (array order = preview order = export order)
  • Finished images: dist/<series>/snapshot/01.webp…NN.webp, every image measured at 1080×1440, lossless WebP
  • Image-quality contract: 2x supersampling + LANCZOS downscale to real size + WebP lossless — applied on every export path
  • First-time export: prompts you to run pip install playwright pillow && playwright install chromium
  • Never does: change the 1080×1440 real dimensions; leak .ruler / .stage / --scale into a card output; commit generated .png / .jpg / .webp into the repo

Prerequisites and boundaries

Prerequisites:

Writable dist/ under the repo root; playwright + chromium + pillow installed before an export run; assets/default.html + assets/app.html inside this skill directory are the sole authoritative templates — day-to-day runs only copy them, never edit.

Not accepted:

  • Editing the templates in assets/ themselves (that's editing the source of truth, done separately)
  • Defining copy input format / paging rules — data modelling, out of scope
  • Generic HTML or screenshot tasks unrelated to this repo

Subtle boundaries:

  • "Change series content" = edit pages.json only (add / remove / reorder cards); the series shell and card HTML are never touched
  • Variable missing in the copy → stop and ask with a proposed value; never silently fill
  • The in-browser "Export all" button is a fallback path; the production route is always scripts/export.py
  • Card outputs must never contain .ruler / .stage / --scale — those are the shell's preview-only helpers

Let's Build Together

Follow us and join the community for updates

WeChat community

Scan to join WeChat group

WeChat QR Code