From 5575024953f7348d53d7f91a2f07b08d42a5c88d Mon Sep 17 00:00:00 2001 From: Dongliang Mu Date: Tue, 14 Apr 2026 21:59:28 +0800 Subject: [PATCH] feat(docs): add PDF and EPUB generation support (#318) - Add mdbook-pdf and mdbook-epub output config with cover image in book.toml - Update README build section with install commands and output paths - Add .DS_Store to .gitignore Co-authored-by: Claude Opus 4.6 (1M context) --- .gitignore | 2 ++ README.md | 11 ++++++++--- book.toml | 6 ++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7e028a0..4fdcc37 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /book/ CLAUDE.md + +.DS_Store diff --git a/README.md b/README.md index 1b6578c..bc1b0c9 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,12 @@ ## 使用 mdBook 构建 -仓库已经支持直接使用 `mdBook` 构建网页书籍。 +仓库已经支持直接使用 `mdBook` 构建网页书籍,同时支持生成 PDF 和 EPUB。 安装: ```bash -cargo install mdbook --locked +cargo install mdbook mdbook-pdf mdbook-epub --locked ``` 构建: @@ -47,7 +47,12 @@ mdbook build mdbook serve --open ``` -生成结果位于 `book/` 目录。仓库同时提供了 GitHub Actions 工作流,在 `master` 分支更新后自动构建并部署 GitHub Pages。 +生成结果位于 `book/` 目录: +- HTML:`book/html/` +- PDF:`book/pdf/output.pdf` +- EPUB:`book/epub/Linux 内核揭秘.epub` + +仓库同时提供了 GitHub Actions 工作流,在 `master` 分支更新后自动构建并部署 GitHub Pages。 ## 邮件列表 diff --git a/book.toml b/book.toml index 3231f58..94f5a92 100644 --- a/book.toml +++ b/book.toml @@ -8,3 +8,9 @@ default-theme = "light" preferred-dark-theme = "navy" git-repository-url = "https://github.com/hust-open-atom-club/linux-insides-zh" site-url = "/linux-insides-zh/" + +[output.pdf] +cover-image = "cover.jpg" + +[output.epub] +cover-image = "cover.jpg"