mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-08 18:01:20 -05:00
Native Quarto callouts (.callout-tip used for Learning Objectives,
.callout-note, etc.) have three sources of visible blank space that
make them look inconsistent with custom foldbox callouts (Napkin Math,
War Story, Example, etc.) across the book:
1. Bootstrap's '.callout-body > :first-child { padding-top: .5rem }'
stacks on top of the body container's own padding-top, producing a
visible gap when the body starts with a <ul>.
2. '.callout-icon-container' and '.callout-title-container' carry
'padding-bottom: 1em' from Quarto's own stylesheet, making the
header 17px taller than a foldbox <summary>.
3. '.callout .callout-body' in _base-styles.scss sets padding-top to
0.75rem; foldbox.css sets its body padding-top to 0.5rem.
Fix, all in foldbox.css (the canonical home for callout geometry):
- Add a :first-child rule symmetric to the existing :last-child rule,
zeroing margin-top and padding-top.
- Zero padding-bottom on .callout-header > .callout-icon-container and
.callout-title-container for native callouts.
In _base-styles.scss:
- Reduce .callout .callout-body padding-top from 0.75rem to 0.5rem to
match foldbox's body padding.
Verified via Playwright measurement: Learning Objectives header height
now 37.17px (was 54.17px), body padding-top 8.5px (was 12.75px), exactly
matching Napkin Math foldbox summary (36.88px / 8.5px).
MLSysBook Extensions
This directory contains Quarto extensions used by the MLSysBook project.
⚠️ CRITICAL WARNING - READ BEFORE MAKING CHANGES
Some extensions in this directory are HEAVILY CUSTOMIZED and should NEVER be reinstalled using quarto add.
🔍 Quick Safety Check
Before installing or updating any extension, ALWAYS check for:
.CUSTOM_LOCKfiles in extension directories- Version numbers ending in
-mlsysbook-custom - Warnings in extension
_extension.ymlfiles
📋 Extension Inventory
| Extension | Status | Safe to Update? |
|---|---|---|
| `margin-video` | 🚫 **100% Custom** | Never (MLSysBook only) |
| `ute/custom-numbered-blocks` | 🚫 **Heavy Customization** | Never |
| `nmfs-opensci/titlepage` | 🚫 **Customized** | Never |
| `pandoc-ext/diagram` | ✅ Standard | Yes |
| `quarto-ext/lightbox` | ✅ Standard | Yes |
🚨 Emergency Recovery
If you accidentally overwrote a custom extension:
# Check what changed
git status
# Restore from git if needed
git checkout HEAD -- book/_extensions/EXTENSION_NAME/
# Run protection check
python tools/scripts/check_custom_extensions.py
📚 Full Documentation
For complete details, see: CUSTOM_EXTENSIONS.md
When in doubt, DON'T reinstall - ask the team first!