#pdf #mdbook #typst #back-end

app mdbook-typst-pdf

mdbook typst pdf backend

4 releases

new 0.5.1 Oct 21, 2024
0.5.0 Oct 21, 2024
0.4.4 Aug 17, 2024
0.4.3 Aug 17, 2024

#238 in Text processing

Download history 226/week @ 2024-08-14 9/week @ 2024-08-21 3/week @ 2024-08-28 26/week @ 2024-09-11 25/week @ 2024-09-18 15/week @ 2024-09-25 5/week @ 2024-10-02 5/week @ 2024-10-09 215/week @ 2024-10-16

251 downloads per month

MIT/Apache

53KB
1K 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

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

~83MB
~1.5M SLoC