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:
Vijay Janapa Reddi
2026-02-17 13:53:18 -05:00
parent 9cee0e9b83
commit 2b27429892
3 changed files with 19 additions and 0 deletions

View File

@@ -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

View File

@@ -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}

View File

@@ -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