md-to-xhs-cards
Convert Markdown into Xiaohongshu (小红书 / RedNote) image cards with deterministic layout, local image support, and optional direct XHS publishing.
What It Does
- Converts
.mdcontent into 3:4 card images (1080x1440by default) - Preserves source order (headings, paragraphs, lists, quotes, code, images)
- Supports Markdown images and Obsidian embeds (
![[...]]) - Generates a cover card and ending signature
- Optionally publishes generated cards to Xiaohongshu
Quick Start
scripts/run_md_to_xhs_cards.sh path/to/post.mdOutput:
NN-card.pngfilesmanifest.json
Render + Publish to XHS
scripts/run_md_to_xhs_cards.sh path/to/post.md \
--publish-xhs \
--publish-title "标题" \
--publish-desc "正文摘要"Dry-run publish:
scripts/run_md_to_xhs_cards.sh path/to/post.md \
--publish-xhs \
--publish-dry-runCookie Configuration
Publishing reads cookie in this order:
--publish-cookieXHS_COOKIEenvironment variable.envin current directory or skill directory
Files
SKILL.md- skill instructions for Codex/Claudescripts/md_to_xhs_cards.py- rendererscripts/publish_xhs.py- publisherreferences/render-spec.md- render options/spec
Keywords
Xiaohongshu, RedNote, 小红书, markdown to image cards, XHS publishing, Codex skill, Claude skill.