#pdf #mdbook #typst #back-end #book

app mdbook-typst-pdf

mdbook typst pdf backend

7 releases

Uses new Rust 2024

new 0.6.2 May 15, 2025
0.6.1 May 13, 2025
0.6.0 Mar 9, 2025
0.5.1 Oct 21, 2024
0.4.4 Aug 17, 2024

#542 in Text processing

Download history 1/week @ 2025-02-19 2/week @ 2025-02-26 110/week @ 2025-03-05 23/week @ 2025-03-12 1/week @ 2025-04-09 4/week @ 2025-04-16 101/week @ 2025-05-07

105 downloads per month
Used in swi-prolog-docs

MIT/Apache

65KB
1.5K SLoC

mdbook-typst-pdf

中文版说明

A mdBook backend for generate pdf (through typst).

For now the primary use case is convert Rust 程序设计语言 简体中文版 to PDF. It should work for other mdbook project, if not welcome to fire an issue.

Installation

  • cargo install mdbook-typst-pdf
  • Or download from releases

Usage

Add follow [output.typst-pdf] section to book.toml then mdbook build

[book]
...

[output.html]
...

[output.typst-pdf]
pdf = true # false for generate typ file only
custom-template = "template.typ" # filename for custom typst template for advanced styling
section-number = true # true for generate chapter head numbering
chapter-no-pagebreak = true # true for not add pagebreak after chapter
rust-book = true # true for enabling rust book specific parsing

Custom template

see src/assets/template.typ file for more details, for now there are two placeholders:

  • MDBOOK_TYPST_PDF_TITLE for title
  • /**** MDBOOK_TYPST_PDF_PLACEHOLDER ****/ for content

Demo PDF

Rust 程序设计语言 简体中文版.pdf

Dependencies

~90MB
~1.5M SLoC