Remove the markup in Markdown (headings #, bold **, list symbols, quotes >, link syntax, etc.) and output as .txt, making it convenient to paste directly into Xiaohongshu.
How to use
Step 0: Set SKILL_DIR
SKILL_DIR="/path/to/xhs-md-to-plain-text"
Step 1: Generate plain text
- Generate the full text (remove markup from the entire file)
npx -y bun ${SKILL_DIR}/scripts/md2text.ts /path/to/article.md --out xhs-img
- Extract only
## 正文内容to## 标签(more suitable for posting directly as the body text)
npx -y bun ${SKILL_DIR}/scripts/md2text.ts /path/to/article.md --body-only --out xhs-img/body.txt
Parameters
npx -y bun ${SKILL_DIR}/scripts/md2text.ts <markdown-file> [options]
Options:
--out <path> 输出文件路径或输出目录(默认: xhs-img)
--body-only 仅抽取“正文内容”段(## 正文内容 → ## 标签)