feat: render PDF version of book with `mdbook-pandoc` (#394)

pull/395/head
Max Heller 2 months ago committed by GitHub
parent a4d5ab5692
commit 2ccd0e1404
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -27,3 +27,12 @@ runs:
- name: Install i18n-helpers
run: cargo install mdbook-i18n-helpers --locked --version '${{ steps.mdbook-i18n-helpers-version.outputs.version }}'
shell: bash
- name: Install mdbook-pandoc and related dependencies
run: |
cargo install mdbook-pandoc --locked --version 0.5.0
sudo apt-get update
sudo apt-get install -y texlive texlive-luatex texlive-lang-cjk librsvg2-bin fonts-noto
curl -LsSf https://github.com/jgm/pandoc/releases/download/3.1.12.2/pandoc-3.1.12.2-linux-amd64.tar.gz | tar zxf -
echo "$PWD/pandoc-3.1.12.2/bin" >> $GITHUB_PATH
shell: bash

@ -40,7 +40,10 @@ jobs:
uses: ./.github/workflows/install-mdbook
- name: Build course in English
run: mdbook build -d book
run: |
mdbook build -d book
mv book/html/* book/pandoc/pdf/patterns.pdf book/
rm -r book/html book/pandoc
# TODO: Activate when first translation is available
# - name: Build all translations

@ -38,3 +38,20 @@ editable = false
# Redirects in the form of "old-path" = "new-path", where the new path
# is relative to the old path.
"functional/lenses.html" = "optics.html"
[output.pandoc]
optional = true
hosted-html = "https://rust-unofficial.github.io/patterns/"
[output.pandoc.profile.pdf]
output-file = "patterns.pdf"
pdf-engine = "lualatex"
[output.pandoc.profile.pdf.variables]
mainfont = "Noto Serif"
sansfont = "Noto Sans"
monofont = "Noto Sans Mono"
mainfontfallback = ["NotoSerifCJKSC:"]
geometry = ["margin=1.25in"]
linkcolor = "blue"
urlcolor = "red"

Loading…
Cancel
Save