Install
openclaw skills install xhs-md2picConvert Markdown text to beautiful Xiaohongshu (XHS) style card images with 5 themes, deterministic browser screenshot rules, auto-pagination, smart title ex...
openclaw skills install xhs-md2picConvert Markdown text into Xiaohongshu (XHS) style multi-page card images with deterministic browser rendering and screenshot behavior.
This skill renders Markdown content as publish-ready XHS card images and is designed to run reliably in browser screenshot services.
Use cases:
Minimal input — just provide Markdown text:
{
"markdown": "## 5个提升效率的方法\n\n**1. 番茄工作法** — 25分钟专注 + 5分钟休息\n\n**2. 任务批处理** — 把相似的事情集中做\n\n> 效率不是做更多的事,而是用更少的时间做对的事。"
}
Default export is one 1125x1500 PNG card (375x500 CSS px at export_scale=3).
See templates/input-schema.json for the full schema.
Core content/style params:
markdown (required): Markdown content. Use --- for manual page breaks.title, author, description: Cover metadata.theme: default, monokai, nord, sakura, mint.font_family: sans-serif, serif, wenkai.padding: small, medium, large.show_cover: Whether to show cover block.bg_style: ai_art or none.Browser screenshot control params:
card_width / card_height: Single card CSS size (default 375x500).export_scale: Pixel ratio multiplier (default 3).viewport_width / viewport_height: Browser viewport size for rendering stability.page_gap: Vertical gap between cards in DOM (default 20).pagination_mode: mixed (default), auto, manual_only.max_pages: Hard limit to avoid runaway pagination.show_page_number: Whether to render 1 / N indicator.avoid_orphan_heading: Keep headings with at least one following block.last_page_compact: Shrink last card when content is short.Use these hard rules for consistent XHS-like output:
3:4 (375x500 base).card_width * export_scale by card_height * export_scale.export_scale=3 for XHS quality (1125x1500).deviceScaleFactor=export_scale.440x760 for default card).document.fonts.ready.document.body[data-fonts-loaded="true"] is present..xhs-card bounding boxes..xhs-card element, never full page + crop.For implementation runbook and failure checks, read references/browser-screenshot-spec.md.
If input is plain text, reformat to Markdown without changing wording:
##, **, lists, quotes)Use python-markdown with extensions:
tables, fenced_code, codehilite, nl2br, sane_lists, smarty, attr_list, md_in_html, toc#tag#) into styled pillsUse templates/card-template.html with fixed card dimensions and theme variables.
Card layers:
.xhs-card: fixed-size card container.bg-art: optional low-opacity decorative image.card-inner: content layer above backgroundApply pagination in DOM, not PDF/print pagination.
Priority order:
---) first.avoid_orphan_heading=true, never place a heading as the last visible block on a page.liOverflow rule:
scrollHeight <= clientHeight.For each page:
.xhs-card nodepage / total_pagesOutput shape:
{
"__type": "xhs_card_images",
"title": "Extracted or provided title",
"theme": "default",
"total_pages": 3,
"pages": [
{
"index": 0,
"page": 1,
"total_pages": 3,
"width": 1125,
"height": 1500,
"size_bytes": 123456,
"url": "https://...",
"oss_uploaded": true
}
]
}
If OSS is not configured, return data_uri for each page.
Before returning images, verify:
last_page_compact=true5 built-in themes are defined in references/themes.md.
| Theme | Background | Feel |
|---|---|---|
default | White #ffffff | Clean, professional |
monokai | Dark #272822 | Tech, developer-oriented |
nord | Deep blue #2e3440 | Nordic minimalist |
sakura | Soft pink #fff5f5 | Warm, feminine |
mint | Light green #f0faf4 | Fresh, natural |
When bg_style: "ai_art":
LLM_BASE_URL is GoogleConstraints:
See references/api-reference.md for provider API details.
Network calls may include:
No raw user document is sent to image models; only abstract prompt text is used.