Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/install-mdbook/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
simonsan marked this conversation as resolved.
Show resolved Hide resolved
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
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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