mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-03-11 17:49:25 -05:00
fix(site): PDF build improvements and community section
- Add npx pre-flight check for Mermaid CLI in PDF build - Configure mermaid_cmd to use npx (no global install needed) - Add Unicode box-drawing fallbacks for LaTeX - Add Community section to PDF table of contents
This commit is contained in:
@@ -29,6 +29,9 @@ serve: clean html
|
||||
pdf:
|
||||
@echo "🔥 Building Tiny🔥Torch PDF via XeLaTeX..."
|
||||
@echo ""
|
||||
@# PDF build needs Mermaid CLI (for diagrams). Config uses npx; Node.js must be installed.
|
||||
@command -v npx >/dev/null 2>&1 || { echo "❌ Error: npx not found. PDF build requires Node.js (for Mermaid diagrams). Install from https://nodejs.org/ or run: brew install node"; exit 1; }
|
||||
@echo "✅ Mermaid CLI (via npx) available"
|
||||
@# Step 1: Generate LaTeX (matches CI workflow)
|
||||
@echo "📚 Generating LaTeX files..."
|
||||
jupyter-book build . --builder latex --config _config_pdf.yml --toc _toc_pdf.yml
|
||||
|
||||
@@ -51,6 +51,8 @@ sphinx:
|
||||
- sphinxcontrib.mermaid
|
||||
config:
|
||||
mermaid_version: "10.6.1"
|
||||
# Use npx so PDF build works without global mermaid-cli (requires Node.js)
|
||||
mermaid_cmd: "npx -y @mermaid-js/mermaid-cli"
|
||||
# Render mermaid as PDF for LaTeX
|
||||
# --pdfFit scales PDF to fit the diagram (not full page)
|
||||
# --scale 1.0 keeps diagrams at natural size (1.5 was too large for tall diagrams)
|
||||
@@ -172,6 +174,13 @@ sphinx:
|
||||
\newunicodechar{ω}{$\omega$}
|
||||
\newunicodechar{✓}{\checkmark}
|
||||
\newunicodechar{✗}{$\times$}
|
||||
% Box-drawing (terminal/code art) - TeX Gyre Cursor has no Unicode box glyphs
|
||||
\newunicodechar{═}{\texttt{=}}
|
||||
\newunicodechar{║}{\texttt{|}}
|
||||
\newunicodechar{╔}{\texttt{+}}
|
||||
\newunicodechar{╗}{\texttt{+}}
|
||||
\newunicodechar{╚}{\texttt{+}}
|
||||
\newunicodechar{╝}{\texttt{+}}
|
||||
|
||||
% Syntax-highlighted code blocks with refined colors
|
||||
\usepackage{listings}
|
||||
|
||||
@@ -121,6 +121,13 @@ parts:
|
||||
- file: conclusion
|
||||
title: "You Built Something Real"
|
||||
|
||||
# Community (referenced from TITO overview)
|
||||
- caption: Community
|
||||
numbered: false
|
||||
chapters:
|
||||
- file: community
|
||||
title: "Community Guide"
|
||||
|
||||
# Appendix
|
||||
- caption: Appendix
|
||||
numbered: false
|
||||
|
||||
Reference in New Issue
Block a user