This PR enhances our book build process based on techniques from the iksnae/rise-and-code project to produce better PDF and EPUB output, with a focus on proper page breaks and formatting for a professional-looking book.
Latest Updates (Mar 17)
Enhanced section separation: Modified LaTeX template to ensure each section starts on a new page
Improved paragraph spacing: Added extra whitespace between paragraphs for better readability
Content formatting script: Added a new tool to help format content files for better PDF/EPUB output
Changes Made
LaTeX Template for PDF Generation
Added a custom LaTeX template in templates/template.tex that provides:
Professional typesetting with proper margins and spacing
Forced section breaks to start each section on a new page
Increased spacing between paragraphs and subsections
Consistent headers and footers with page numbers
Proper formatting for chapters, sections, and activities
Support for proper rendering of code blocks, tables, and other elements
Color coding for headings and section titles
Enhanced Build Process
Updated build.sh to:
Update the LaTeX template with proper version and date information
Process all markdown files with proper ordering
Insert explicit page breaks between sections and activities
Use custom template for PDF generation
Generate proper EPUB output with metadata
Create HTML output for online reading
GitHub Workflow Improvements
Modified the GitHub workflow to:
Install additional LaTeX dependencies for better typography
Use the enhanced build script with template support
Better output checking and validation
Improved release notes
Benefits
Books will now have professional-quality formatting in PDF output
Each chapter and section will start on a new page with proper spacing
Activities will be on their own pages for better readability
Consistent headers and footers with page numbers and version info
Better EPUB formatting for e-readers
More robust build process that handles errors gracefully
Implementation Notes
This approach is inspired by the successful book formatting techniques used in the rise-and-code project. The LaTeX template provides fine-grained control over the appearance of the PDF, ensuring that each part of the book is properly formatted according to publishing standards.
The build process now generates three distinct output formats:
PDF - Professional-quality document with proper page breaks and formatting
EPUB - Optimized for e-readers with reflowable content
HTML - For online reading via GitHub Pages
The new content formatting script (tools/format-content.js) can be run to improve the formatting of existing content files, adding appropriate whitespace and page breaks.
These changes don't modify any of the content itself, but they significantly improve the reading experience of the generated book across all formats.
This PR enhances our book build process based on techniques from the
iksnae/rise-and-code
project to produce better PDF and EPUB output, with a focus on proper page breaks and formatting for a professional-looking book.Latest Updates (Mar 17)
Changes Made
LaTeX Template for PDF Generation
templates/template.tex
that provides:Enhanced Build Process
build.sh
to:GitHub Workflow Improvements
Benefits
Implementation Notes
This approach is inspired by the successful book formatting techniques used in the
rise-and-code
project. The LaTeX template provides fine-grained control over the appearance of the PDF, ensuring that each part of the book is properly formatted according to publishing standards.The build process now generates three distinct output formats:
The new content formatting script (
tools/format-content.js
) can be run to improve the formatting of existing content files, adding appropriate whitespace and page breaks.These changes don't modify any of the content itself, but they significantly improve the reading experience of the generated book across all formats.