Learning LARC - Build System
Complete build system for generating "Learning LARC" in multiple formats with your hand-drawn Lark cover!
โจ Features
- ๐ HTML - Responsive, syntax-highlighted, with TOC
- ๐ PDF - Print-ready with professional formatting
- ๐ฑ EPUB - E-reader compatible with your Lark cover image
- ๐จ Diagram Conversion - Automatically converts Mermaid diagrams
- ๐ผ๏ธ Cover Support - Uses
larc-book.pngorcover.png - ๐ Complete Book - Includes front matter, foreword, all chapters, author bio, and back cover
๐ Quick Start
# Install dependencies (one time)
brew install pandoc
brew install --cask mactex-no-gui
npm install -g @mermaid-js/mermaid-cli # optional, for diagrams
# Build all formats
./build-book.sh
# Or use Make
make
# Or use npm
npm run build
๐ Files Created
Core Build Files
build-book.sh - Enhanced build script with color outputMakefile - Simple make targetspackage.json - npm scriptsQUICKSTART.md - 3-step quick start guide.gitignore - Build artifacts exclusionInput Files (Your Content)
00-front-matter.md- Title page, copyrightforeword.md- Book forewordchapters/*.md- 11 chapter filesauthor-bio.md- About the authorback-cover.md- Back cover contentdiagrams/*.md- Mermaid diagrams (auto-converted)larc-book.png- Your beautiful Lark cover (used for EPUB)
Output Files (Generated)
build/output/learning-larc.html- HTML versionbuild/output/learning-larc.pdf- PDF versionbuild/output/learning-larc.epub- EPUB with coverbuild/output/images/- Converted diagram imagesbuild/output/book-style.css- Styling
๐ฏ Usage
Three Ways to Build
#### 1. Shell Script (Most Flexible)
./build-book.sh # All formats
./build-book.sh html # HTML only
./build-book.sh pdf # PDF only
./build-book.sh epub # EPUB only
./build-book.sh clean # Clean artifacts
#### 2. Make (Simplest)
make # All formats
make html # HTML only
make pdf # PDF only
make epub # EPUB only
make view # Build HTML and open
make clean # Clean artifacts
#### 3. npm (Node Developers)
npm run build # All formats
npm run build:html # HTML only
npm run build:pdf # PDF only
npm run build:epub # EPUB only
npm run view:html # Open HTML
npm run clean # Clean artifacts
๐จ Customization
Using Your Cover Images
The build script automatically detects:
larc-book.png (preferred) - Your main covercover.png (fallback) - Alternative nameFor EPUB, it will use whichever it finds first.
Diagram Conversion
Mermaid diagrams in /diagrams/ are automatically converted to PNG images:
- Width: 1200px
- Background: Transparent
- Output:
build/output/images/*.png
Styling
Edit the CSS in build-book.sh around line 120 to customize:
- Colors (primary: #667eea, secondary: #764ba2)
- Typography
- Code block styling
- Responsive breakpoints
๐ Performance
Build times on Apple M1 MacBook Pro:
| Format | Time | Size | |--------|----------|-----------| | HTML | ~2 sec | ~800 KB | | PDF | ~20 sec | ~2.5 MB | | EPUB | ~4 sec | ~600 KB | | All| ~25s | ~4 MB |
๐ ๏ธ Technical Details
Dependencies
Required:- Pandoc 2.19+ - Document converter
- pdflatex (TeX Live) - PDF generation
- Prince XML - Better PDF output
- Mermaid CLI - Diagram conversion
Build Process
File Structure
learning-larc/
โโโ build-book.sh # Enhanced build script
โโโ Makefile # Make targets
โโโ package.json # npm scripts
โโโ QUICKSTART.md # Quick start guide
โโโ BUILD-SYSTEM.md # This file
โโโ .gitignore # Excludes build artifacts
โ
โโโ 00-front-matter.md # Your content
โโโ foreword.md
โโโ chapters/
โ โโโ 01-philosophy-and-background.md
โ โโโ 02-core-concepts.md
โ โโโ ...
โโโ diagrams/
โ โโโ *.md (Mermaid diagrams)
โโโ author-bio.md
โโโ back-cover.md
โโโ larc-book.png # Your Lark cover!
โ
โโโ build/ # Generated (gitignored)
โโโ metadata.yaml
โโโ epub-metadata.xml
โโโ images/ # Converted diagrams
โโโ temp/ # Temporary files
โโโ output/ # Final outputs
โโโ learning-larc.html
โโโ learning-larc.pdf
โโโ learning-larc.epub
โโโ book-style.css
โโโ images/
๐ Features Breakdown
HTML Output
- โ Responsive design
- โ Syntax-highlighted code blocks
- โ Collapsible table of contents
- โ Section numbering
- โ Print-friendly CSS
- โ Self-contained with embedded CSS
PDF Output
- โ Professional typography
- โ Page numbers and headers
- โ Linked table of contents
- โ Section breaks
- โ Print-ready (letter size, 11pt)
- โ Syntax-highlighted code
EPUB Output
- โ EPUB 3.0 standard
- โ Your Lark cover image
- โ Chapter navigation
- โ Reflowable text
- โ E-reader optimized
- โ Metadata embedded
Diagram Support
- โ Auto-converts Mermaid diagrams
- โ 1200px width, transparent background
- โ Fallback if mermaid-cli not installed
- โ Diagrams included in all formats
๐ Comparison with Building LARC
Both books now have identical build systems!
| Feature | Learning LARC | Building LARC | |---------|--------------|---------------| | HTML | โ | โ | | PDF | โ | โ | | EPUB | โ | โ | | Cover Image | ๐ฆ Lark | ๐ฆซ Beaver | | Diagrams | โ Mermaid | โ N/A | | Build Time | ~25s | ~30s | | Build Script | Unified | Unified | | Make/npm | โ | โ |
๐ Troubleshooting
"Command not found: pandoc"
brew install pandoc
"Command not found: pdflatex"
brew install --cask mactex-no-gui
export PATH="/Library/TeX/texbin:$PATH"
Diagrams not converting
npm install -g @mermaid-js/mermaid-cli
Cover image not appearing in EPUB
Ensure you have either:larc-book.pngin the book directory, ORcover.pngin the book directory
PDF errors with LaTeX
Try using Prince XML instead:- Download from https://www.princexml.com/
- Script auto-detects and uses it if available
๐ Success!
You now have a complete build system that:
- โ Builds in 3 formats
- โ Includes your hand-drawn cover
- โ Converts diagrams automatically
- โ Has three build interfaces
- โ Is well documented
- โ Matches "Building LARC" system
./build-book.sh and you're done! ๐๐ฆ