← 返回 Skills 市场
renbigcheng

Book-PDF:书籍级PDF手册生成器

作者 RenBigCheng · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
281
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install book-pdf
功能描述
深度调研一个主题,生成100页+书籍级PDF手册。模块化HTML片段架构 + 语义化版本管理 + 多Agent并行写作 + Playwright渲染PDF。 当用户需要制作完整的PDF手册、电子书、橙皮书、参考指南时触发。即使用户只是说「做一本书」「做个PDF手册」「做个完整指南」「做一本XX的手册」也应触发。...
使用说明 (SKILL.md)

Book-PDF:书籍级PDF手册全流程

从一个主题到100页+专业PDF。五个阶段:调研 → 规划 → 写作 → 构建 → 版本更新。

前置依赖

  • Node.js >= 16
  • Playwright:npm install playwright && npx playwright install chromium

参考资料导航

需要时读取 文件 内容
写HTML片段时 references/design-system.md CSS变量、主题、组件HTML速查、视觉红线
新建项目时 templates/ 目录 可直接复制的骨架文件(build.js/build-pdf.js/update.sh/styles.css)
参考已有项目时 01-公众号写作/_过程文件/openclaw-guide/ 首个实战项目(8 Part、35节、100页+)

项目初始化

用 init 脚本一键创建项目骨架:

bash scripts/init-project.sh \x3C项目目录> \x3C手册标题>
# 示例:bash scripts/init-project.sh ./my-guide "Python完全指南"

自动创建目录结构、复制模板文件、生成 version.json/CHANGELOG.md/PROJECT.md、检查依赖。

项目结构

{项目名}/
├── PROJECT.md          # 项目中枢(大纲+进度+数据速查)
├── styles.css          # 共享CSS(从templates/复制)
├── build.js            # HTML合并脚本(从templates/复制,改FRAGMENT_ORDER)
├── build-pdf.js        # Playwright PDF渲染(从templates/复制)
├── update.sh           # 一键版本更新(从templates/复制)
├── version.json        # {"version":"1.0.0","build":1,"lastUpdate":"","title":""}
├── CHANGELOG.md        # 更新日志
├── fragments/          # 内容片段(纯HTML,不含\x3Chtml>\x3Chead>)
│   ├── 00-cover.html / 01-toc.html
│   ├── part{N}-{中文简称}.html
│   ├── appendix.html / 99-backpage.html
├── research/           # 调研资料
├── output/             # {title}-v{version}.html/.pdf
└── versions/           # 历史PDF存档

阶段1:调研

  1. 与用户确定主题和目标读者
  2. 拆分调研维度(6-10个方向)
  3. 启动多个background agent并行调研,每份保存到 {项目目录}/research/YYYY-MM-{关键词}.md
  4. 调研完成后汇总,进入规划

阶段2:规划

编辑项目目录下的 PROJECT.md,包含:

  • 章节大纲表(Part + 节号 + 标题 + 核心内容 + 信息来源)
  • 调研资料索引(路径 + 摘要 + 状态)
  • Agent并行分工方案(关联性强的Part分给同一个agent)
  • 进度追踪表 + 关键数据速查

修改 build.js 中的 FRAGMENT_ORDER。与用户确认大纲后进入写作。

阶段3:写作

多Agent并行,每个agent输出一个HTML片段。

每个写作agent需要:

  1. 读取 references/design-system.md 了解可用组件和片段结构规范
  2. 读取对应调研资料
  3. 输出纯HTML片段(不含 \x3Chtml>\x3Chead>\x3Cstyle> 标签,只写正文内容)

⚠️ 片段结构铁律(必须在agent prompt中明确告知)

每个正文片段必须遵循以下结构,否则PDF排版会出错:

\x3Cdiv class="content">
\x3Ch2 class="section-title page-break" id="partN">\x3Cspan class="num">§0N\x3C/span> 标题\x3C/h2>
\x3Cp class="section-en">English Title\x3C/p>
\x3Cp class="section-intro">概述\x3C/p>
\x3C!-- 正文 -->
\x3C/div>

三条规则:

  • \x3Cdiv class="content"> 包裹 → 控制左右边距(没有它内容顶边)
  • id="partN" 属性 → 目录锚点跳转需要
  • page-break class → 每章从新页开始

目录片段使用 .toc + .toc-item + \x3Ca href="#partN"> 结构。详见 design-system.md。

作者信息配置(可选)

封面和尾页支持自定义作者信息,在 version.json 中配置:

{
  "title": "手册标题",
  "author": {
    "name": "作者名称",
    "title": "作者头衔/简介",
    "bio": "详细简介(显示在尾页)",
    "subtitle": "副标题",
    "exclusive": "专属内容说明(封面底部)",
    "qrImage": "二维码图片路径",
    "linkUrl": "链接地址",
    "linkText": "链接文字",
    "social": "社交链接(HTML格式)"
  }
}

封面占位符

  • {{AUTHOR_NAME}} - 作者名称
  • {{AUTHOR_TITLE}} - 作者头衔
  • {{AUTHOR_EXCLUSIVE}} - 专属内容说明

尾页占位符

  • {{BOOK_TITLE}} - 手册标题
  • {{BOOK_SUBTITLE}} - 副标题
  • {{AUTHOR_NAME}} - 作者名称
  • {{AUTHOR_BIO}} - 作者简介
  • {{AUTHOR_QR_IMAGE}} - 二维码图片
  • {{AUTHOR_LINK_URL}} - 链接地址
  • {{AUTHOR_LINK_TEXT}} - 链接文字
  • {{AUTHOR_SOCIAL}} - 社交链接
  • {{VERSION}} - 版本号
  • {{YEAR}} - 年份

详细模板见 design-system.md 和 templates/fragments/

阶段4:构建

node build.js       # 合并片段 → HTML
node build-pdf.js   # Playwright → PDF
# 或一键:
./update.sh build   # 仅构建

阶段5:版本更新

修改 fragments/*.html 后运行:

./update.sh patch "修正某个错误"     # 1.0.0 → 1.0.1
./update.sh minor "更新内容"          # 1.0.0 → 1.1.0
./update.sh major "新增章节"          # 1.0.0 → 2.0.0

自动:更新version.json → 写CHANGELOG → build HTML(版本号注入封面)→ 生成PDF → 备份到versions/

快速启动清单

  1. 确定主题、读者、规模
  2. bash scripts/init-project.sh \x3C目录> \x3C标题> 创建项目
  3. 修改 build.js 的 FRAGMENT_ORDER
  4. 编辑 PROJECT.md(大纲+调研索引+进度)
  5. 多Agent并行调研 → 并行写作 → ./update.sh minor "初版" 构建
安全使用建议
This skill is internally consistent with its stated purpose, but review and accept these points before installing/using it: - SKILL.md requires Node.js >=16 and Playwright (the registry metadata did not list these) — install those first (npm install playwright && npx playwright install chromium). Playwright will download a browser binary. - The provided scripts will create and write files in the project directory you pass to init-project.sh (do not point it at an existing non-empty directory unless you want files copied there). - The PDF render uses Playwright to open a local file:// HTML page; if your fragments contain remote image or resource URLs, Playwright may fetch external resources during rendering. Avoid embedding sensitive local/remote URLs in fragments if you are concerned about network fetches. - The workflow mentions launching background agents and saving research files into the project — this will create files under the chosen project directory; confirm you are comfortable with the agent writing content there. - As with any third-party templates/scripts, inspect templates/fragments/styles.css/build.js/build-pdf.js/update.sh before running, especially if you will run them in sensitive environments. Overall: coherent and appropriate for a local book/PDF generation tool; no credentials or hidden network endpoints were found, so proceed after the checks above.
功能分析
Type: OpenClaw Skill Name: book-pdf Version: 1.0.0 The skill bundle provides a legitimate framework for an AI agent to research, write, and render professional PDF manuals. It uses a combination of shell scripts (init-project.sh, update.sh) and Node.js scripts (build.js, build-pdf.js) to automate the document lifecycle, including versioning and Playwright-based PDF generation. While the scripts require filesystem and execution permissions, their logic is transparent and strictly aligned with the stated purpose of document building; no evidence of data exfiltration, unauthorized network activity, or malicious prompt injection was found.
能力评估
Purpose & Capability
The skill's stated purpose (generate 100+ page PDF books) matches the included scripts (build.js, build-pdf.js, update.sh) and templates. Minor inconsistency: registry metadata lists no required binaries/env, but SKILL.md clearly requires Node.js >=16 and Playwright (npm install playwright && npx playwright install chromium). This is expected for the described capability but should be represented in the metadata.
Instruction Scope
Runtime instructions stay within the declared purpose: initialize a project, read design-system.md and local research files, write fragments, merge HTML, and render PDF with Playwright. The SKILL.md does reference an example path (`01-公众号写作/_过程文件/openclaw-guide/`) outside the template that is only advisory; the included scripts do not automatically scan arbitrary system paths. The skill also instructs agents to spawn background research agents (logical workflow) — this is workflow behavior, not hidden I/O, but you should be aware agents will write project files under the chosen project directory.
Install Mechanism
No install spec is provided (instruction-only for the platform). The code relies on the user/environment having Node.js and Playwright installed; there are no remote downloads or archive extraction inside the skill itself. This is low-risk but requires the user to install Playwright (which downloads browser engines when run).
Credentials
The skill requests no credentials, no environment variables, and no special config paths. File I/O is limited to the project directory created by init-project.sh and standard output/versions directories. That level of access is proportionate to building and storing PDFs.
Persistence & Privilege
Skill is not always-enabled and uses normal model invocation. It does not request persistent platform-level privileges or modify other skills. Scripts create files within the chosen project directory only.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install book-pdf
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /book-pdf 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
首个发布版本:极简黑白灰主题,支持自定义作者信息,多Agent并行写作
元数据
Slug book-pdf
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Book-PDF:书籍级PDF手册生成器 是什么?

深度调研一个主题,生成100页+书籍级PDF手册。模块化HTML片段架构 + 语义化版本管理 + 多Agent并行写作 + Playwright渲染PDF。 当用户需要制作完整的PDF手册、电子书、橙皮书、参考指南时触发。即使用户只是说「做一本书」「做个PDF手册」「做个完整指南」「做一本XX的手册」也应触发。... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 281 次。

如何安装 Book-PDF:书籍级PDF手册生成器?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install book-pdf」即可一键安装,无需额外配置。

Book-PDF:书籍级PDF手册生成器 是免费的吗?

是的,Book-PDF:书籍级PDF手册生成器 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Book-PDF:书籍级PDF手册生成器 支持哪些平台?

Book-PDF:书籍级PDF手册生成器 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Book-PDF:书籍级PDF手册生成器?

由 RenBigCheng(@renbigcheng)开发并维护,当前版本 v1.0.0。

💬 留言讨论