book/tools/scripts/docs/FORMATTING_PRESERVATION.md
When performing textbook polish, editing, or content improvements, you MUST preserve these specific formatting patterns. These are not arbitrary style choices but deliberate educational formatting that enhances readability and pedagogical effectiveness.
Rule: The first column of grid tables MUST have bold formatting.
Why: This emphasizes the primary concept being compared or categorized, making tables scannable and improving comprehension.
+---------------------------+----------------------+
| Strategy | Search Efficiency |
+:==========================+:=====================+
| **Reinforcement Learning** | 400-1000 GPU-days |
+---------------------------+----------------------+
| **Evolutionary Algorithms** | 200-500 GPU-days |
+---------------------------+----------------------+
+---------------------------+----------------------+
| Strategy | Search Efficiency |
+:==========================+:=====================+
| Reinforcement Learning | 400-1000 GPU-days |
+---------------------------+----------------------+
| Evolutionary Algorithms | 200-500 GPU-days |
+---------------------------+----------------------+
Rule: Section headers inside callout blocks MUST be bold and title case, ending with a colon.
Why: These headers organize complex information within callouts, creating visual hierarchy that helps students navigate checkpoint questions and learning objectives.
::: {.callout-note title="Checkpoint"}
Before proceeding, verify your understanding:
**Integration Across Phases:**
- [ ] Can you trace how architectural decisions impact performance?
- [ ] Do you understand memory requirements?
**Training To Deployment:**
- [ ] Can you explain the complete lifecycle?
:::
::: {.callout-note title="Checkpoint"}
Before proceeding, verify your understanding:
Integration across phases:
- [ ] Can you trace how architectural decisions impact performance?
- [ ] Do you understand memory requirements?
Training to deployment:
- [ ] Can you explain the complete lifecycle?
:::
Rule: All figure and table captions MUST follow the **Bold Title**: Explanation format.
Why: This creates consistent visual anchoring across hundreds of figures and tables, making it easy for students to identify what they're looking at and why it matters.
: **NAS Search Strategy Comparison**: Trade-offs between search efficiency, use cases, and limitations for different NAS approaches. {#tbl-nas-strategies}
: **System Resource Evolution**: Programming paradigms shift system demands from sequential computation to massive matrix operations. {#tbl-evolution}
: **Attention Mechanism**: Transformer models compute attention through query-key-value interactions, enabling dynamic focus across input sequences. {#fig-attention}
: NAS Search Strategy Comparison {#tbl-nas-strategies}
: System Resource Evolution: Programming paradigms shift... {#tbl-evolution}
: Attention Mechanism - Transformer models compute... {#fig-attention}
When editing content:
**Section Header:** to lowercase or remove bold**Title**: Explanation to any other formatIf formatting is accidentally removed, use:
python tools/scripts/restore_formatting.py <file_paths>
This script automatically:
The rule about not starting paragraphs with bold text does NOT apply to:
It DOES apply to:
## Section Title
**Key Concept**: Neural networks process data through layers.
This ↑ should be rewritten as:
## Section Title
Neural networks process data through layers, transforming inputs...
But this ↓ should be kept as-is:
::: {.callout-note}
**Key Concept:**
- Point 1
- Point 2
:::
Cognitive Load Management: Bold formatting creates visual hierarchy that helps students scan and navigate complex technical content without overwhelming working memory.
Pattern Recognition: Consistent formatting across 270+ figures and 90+ tables trains students to quickly identify and understand visual elements, reducing cognitive overhead for content comprehension.
Checkpoint Effectiveness: Bold section headers in callouts improve self-assessment by making it easy to identify which skill category each checkpoint question targets.
Table Scannability: Bold first columns enable rapid table lookup during problem-solving, when students need to quickly find relevant information.
This textbook renders in multiple formats (HTML, PDF, EPUB). The formatting patterns ensure:
After any content editing, run:
# Check for formatting issues
python tools/scripts/restore_formatting.py --dry-run quarto/contents/core/*/*.qmd
# Fix any issues found
python tools/scripts/restore_formatting.py quarto/contents/core/*/*.qmd
The script will report:
When creating new AI agents or editing workflows:
restore_formatting.py after AI editing passesLast Updated: October 7, 2025
Maintainer: MLSysBook Team
Related Scripts: tools/scripts/restore_formatting.py