mirror of
https://github.com/comeonzhj/Auto-Redbook-Skills.git
synced 2026-03-27 04:29:28 +08:00
feat: v2.0 智能分页渲染 + 7种可选样式
新增功能: - 智能分页渲染脚本(Python/Node.js),自动解决内容溢出问题 - 7种可选样式主题:purple, xiaohongshu, mint, sunset, ocean, elegant, dark - 新增 STYLES.md 样式选择指南 - 更新 README,添加 v2.0 更新说明 - 保留 V1 旧版脚本保证兼容性 使用方式: python scripts/render_xhs_v2.py note.md --style sunset
This commit is contained in:
109
README.md
109
README.md
@@ -6,6 +6,56 @@
|
||||
[](https://nodejs.org/)
|
||||
[](LICENSE)
|
||||
|
||||
---
|
||||
|
||||
## 🆕 v2.0 版本更新
|
||||
|
||||
### ✨ 新增功能
|
||||
|
||||
- **🚀 智能分页渲染** - 自动检测内容高度,超出时自动拆分到多张卡片,彻底解决文字溢出问题
|
||||
- **🎨 7种可选样式** - 新增多种主题风格,一键切换不同视觉效果
|
||||
- **⚡ V2 渲染脚本** - 全新 `render_xhs_v2.py` / `render_xhs_v2.js`,推荐升级使用
|
||||
|
||||
### 📋 可用样式列表
|
||||
|
||||
| 样式 | 名称 | 预览 |
|
||||
|------|------|------|
|
||||
| `purple` | 紫韵(默认)| 蓝紫色渐变 |
|
||||
| `xiaohongshu` | 小红书红 | 品牌红色系 |
|
||||
| `mint` | 清新薄荷 | 绿色自然调 |
|
||||
| `sunset` | 日落橙 | 粉橙浪漫调 |
|
||||
| `ocean` | 深海蓝 | 海洋蓝色调 |
|
||||
| `elegant` | 优雅白 | 灰白简约调 |
|
||||
| `dark` | 暗黑模式 | 深色高对比 |
|
||||
|
||||
### 🎯 使用 V2 脚本
|
||||
|
||||
```bash
|
||||
# Python 版本
|
||||
python scripts/render_xhs_v2.py note.md --style sunset
|
||||
|
||||
# Node.js 版本
|
||||
node scripts/render_xhs_v2.js note.md --style ocean
|
||||
|
||||
# 查看所有样式
|
||||
python scripts/render_xhs_v2.py --list-styles
|
||||
```
|
||||
|
||||
### 📁 v2.0 新增文件
|
||||
|
||||
```
|
||||
scripts/
|
||||
├── render_xhs_v2.py # 新增:Python 智能分页版(推荐)
|
||||
├── render_xhs_v2.js # 新增:Node.js 智能分页版(推荐)
|
||||
├── render_xhs.py # 旧版:保留兼容
|
||||
└── render_xhs.js # 旧版:保留兼容
|
||||
STYLES.md # 新增:样式选择指南
|
||||
```
|
||||
|
||||
**注:V1 旧版脚本保留兼容,V2 版本完全向下兼容 Markdown 格式。**
|
||||
|
||||
---
|
||||
|
||||
## ✨ 功能特性
|
||||
|
||||
- 📝 **撰写笔记** - 根据既定主题,撰写小红书笔记(提示词自己调整,在 `SKILL.md`里)
|
||||
@@ -22,7 +72,7 @@ Clone 项目到本地
|
||||
|
||||
```bash
|
||||
|
||||
git clone https://github.com/comeonzhj/Auto-Redbook-Skills.git
|
||||
git clone https://github.com/comeonzhj/Auto-Redbook-Skills.git
|
||||
|
||||
```
|
||||
|
||||
@@ -49,6 +99,41 @@ npm install
|
||||
npx playwright install chromium
|
||||
```
|
||||
|
||||
## 🎨 渲染图片
|
||||
|
||||
### V2 渲染(推荐)
|
||||
|
||||
```bash
|
||||
# 使用默认样式
|
||||
python scripts/render_xhs_v2.py note.md
|
||||
|
||||
# 指定样式主题
|
||||
python scripts/render_xhs_v2.py note.md --style sunset
|
||||
|
||||
# 指定输出目录
|
||||
python scripts/render_xhs_v2.py note.md -o ./output --style xiaohongshu
|
||||
|
||||
# 查看所有样式
|
||||
python scripts/render_xhs_v2.py --list-styles
|
||||
```
|
||||
|
||||
**V2 特性:**
|
||||
- 智能分页:自动检测内容高度,自动拆分卡片
|
||||
- 固定尺寸:所有卡片固定 1080×1440px
|
||||
- 多种样式:7种预设主题风格
|
||||
|
||||
### V1 渲染(旧版)
|
||||
|
||||
```bash
|
||||
# Python 版本
|
||||
python scripts/render_xhs.py note.md
|
||||
|
||||
# Node.js 版本
|
||||
node scripts/render_xhs.js note.md
|
||||
```
|
||||
|
||||
**注意:** V1 版本当内容过长时可能出现溢出,建议手动使用 `---` 分隔内容。
|
||||
|
||||
## 📤 发布到小红书
|
||||
|
||||
### 1. 配置 Cookie
|
||||
@@ -93,7 +178,7 @@ python scripts/publish_xhs.py \
|
||||
|
||||
## 🎨 自定义样式
|
||||
|
||||
### 修改背景渐变
|
||||
### 修改背景渐变(V1)
|
||||
|
||||
编辑 `assets/card.html` 中的 `.card-container`:
|
||||
|
||||
@@ -113,9 +198,16 @@ python scripts/publish_xhs.py \
|
||||
| 绿色 | `#43e97b → #38f9d7` |
|
||||
| 橙黄 | `#fa709a → #fee140` |
|
||||
|
||||
### 修改封面样式
|
||||
### 更多样式选择(V2)
|
||||
|
||||
编辑 `assets/cover.html` 中的样式。
|
||||
V2 版本提供 7 种内置样式,通过 `--style` 参数快速切换:
|
||||
|
||||
```bash
|
||||
python scripts/render_xhs_v2.py note.md --style dark # 暗黑模式
|
||||
python scripts/render_xhs_v2.py note.md --style mint # 清新薄荷
|
||||
```
|
||||
|
||||
详见 [STYLES.md](./STYLES.md)
|
||||
|
||||
## 📁 项目结构
|
||||
|
||||
@@ -123,6 +215,7 @@ python scripts/publish_xhs.py \
|
||||
md2Redbook/
|
||||
├── SKILL.md # 技能描述(AI Agent 使用)
|
||||
├── README.md # 项目文档
|
||||
├── STYLES.md # 样式选择指南
|
||||
├── requirements.txt # Python 依赖
|
||||
├── package.json # Node.js 依赖
|
||||
├── env.example.txt # Cookie 配置示例
|
||||
@@ -132,8 +225,10 @@ md2Redbook/
|
||||
│ ├── styles.css # 共用样式表
|
||||
│ └── example.md # 示例 Markdown
|
||||
└── scripts/
|
||||
├── render_xhs.py # Python 渲染脚本
|
||||
├── render_xhs.js # Node.js 渲染脚本
|
||||
├── render_xhs_v2.py # Python 渲染脚本 V2(推荐)
|
||||
├── render_xhs_v2.js # Node.js 渲染脚本 V2(推荐)
|
||||
├── render_xhs.py # Python 渲染脚本 V1
|
||||
├── render_xhs.js # Node.js 渲染脚本 V1
|
||||
└── publish_xhs.py # 小红书发布脚本
|
||||
```
|
||||
|
||||
@@ -149,7 +244,7 @@ md2Redbook/
|
||||
|
||||
- [Playwright](https://playwright.dev/) - 浏览器自动化渲染
|
||||
- [Marked](https://marked.js.org/) - Markdown 解析
|
||||
- [Madopic](https://github.com/xiaolinbaba/Madopic) - Markdown 渲染
|
||||
- [Madopic](https://github.com/xiaolinbaba/Madopic) - Markdown 渲染
|
||||
- [xhs](https://github.com/ReaJason/xhs) - 小红书 API 客户端
|
||||
|
||||
## 📄 License
|
||||
|
||||
Reference in New Issue
Block a user