Skip to content

Commit bf55d96

Browse files
committed
feat: 增加pdf输出功能
1 parent 84559e8 commit bf55d96

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/main.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ permissions:
1111

1212
env:
1313
MDBOOK_VERSION: 0.5.1
14+
MDBOOK_TYPST_PDF_VERSION: 0.2.1
15+
TYPST_VERSION: 0.12.0
1416

1517
jobs:
1618
deploy:
@@ -29,6 +31,16 @@ jobs:
2931
mkdir bin
3032
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
3133
echo "$(pwd)/bin" >> "${GITHUB_PATH}"
34+
35+
- name: Install typst
36+
run: |
37+
curl -sSL https://github.com/typst/typst/releases/download/v${TYPST_VERSION}/typst-x86_64-unknown-linux-musl.tar.xz | tar -xJ --directory=bin --strip-components=1
38+
echo "$(pwd)/bin" >> "${GITHUB_PATH}"
39+
40+
- name: Install mdbook-typst-pdf
41+
run: |
42+
curl -sSL https://github.com/KaiserY/mdbook-typst-pdf/releases/download/v${MDBOOK_TYPST_PDF_VERSION}/mdbook-typst-pdf-v${MDBOOK_TYPST_PDF_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
43+
echo "$(pwd)/bin" >> "${GITHUB_PATH}"
3244
3345
# 2. 编译
3446
- name: Build book

book.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ custom-template = "custom-template.typ"
2525
pdf = true
2626
section-number = true
2727
rust-book = true
28-
optional = true
2928

3029
[rust]
3130
edition = "2024"

src/title-page.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
本书的英文原版 HTML 格式可以在 [https://doc.rust-lang.org/stable/book/](https://doc.rust-lang.org/stable/book/) 在线阅读;使用 `rustup` 安装的 Rust 也包含一份英文离线版,运行 `rustup docs --book` 即可打开。
1010

11-
本书还有一些社区 [翻译版本][translations]。(译者注:简体中文译本可以在 [https://kaisery.github.io/trpl-zh-cn/](https://kaisery.github.io/trpl-zh-cn/) 在线阅读,PDF 版本请下载 [Rust 程序设计语言 简体中文版.pdf](https://kaisery.github.io/trpl-zh-cn/Rust%20%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1%E8%AF%AD%E8%A8%80%20%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%E7%89%88.pdf)
11+
本书还有一些社区 [翻译版本][translations]。(译者注:简体中文译本可以在 [https://rust.webtech.wiki/](https://rust.webtech.wiki/) 在线阅读,PDF 版本请下载 [Rust 程序设计语言 简体中文版.pdf](https://rust.webtech.wiki/typst-pdf/book.pdf)
1212

1313
本书也有[由 No Starch Press 出版的纸质版和电子版][nsprust]
1414

0 commit comments

Comments
 (0)