Skip to content

Commit 47ced2c

Browse files
ofriwclaude
andcommitted
Add presentation generation script with markdown parser
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 068acfa commit 47ced2c

File tree

3 files changed

+1110
-0
lines changed

3 files changed

+1110
-0
lines changed

scripts/PRESENTATION_README.md

Lines changed: 331 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,331 @@
1+
# Presentation Generation System
2+
3+
This system generates AI-powered presentation slides from lesson content for classroom teaching.
4+
5+
## Overview
6+
7+
The presentation generation system follows the same pattern as the podcast generation:
8+
9+
1. **Parse** lesson MDX content and extract clean text
10+
2. **Generate** condensed presentation slides using Claude Code CLI (Haiku 4.5)
11+
3. **Output** structured JSON with slides, speaker notes, and metadata
12+
4. **Deploy** presentations alongside the Docusaurus site
13+
14+
## Architecture
15+
16+
```
17+
MDX Lesson → AI Processing → JSON Presentation → Reveal.js → Classroom Display
18+
```
19+
20+
### Components
21+
22+
- **generate-presentation.js** - AI-powered script generator
23+
- **RevealSlideshow.tsx** - Reveal.js wrapper component
24+
- **PresentationToggle.tsx** - Toggle button for docs pages
25+
- **DocItem/Layout** - Swizzled Docusaurus component that injects the toggle
26+
27+
## Usage
28+
29+
### Generate Presentations
30+
31+
```bash
32+
# Interactive mode (select file)
33+
node scripts/generate-presentation.js
34+
35+
# Generate for specific file
36+
node scripts/generate-presentation.js --file intro.md
37+
38+
# Generate for all files in a module
39+
node scripts/generate-presentation.js --module understanding-the-tools
40+
41+
# Generate for all lessons
42+
node scripts/generate-presentation.js --all
43+
44+
# Debug mode (saves AI prompt for inspection)
45+
node scripts/generate-presentation.js --file intro.md --debug
46+
```
47+
48+
### View Presentations
49+
50+
1. **In Development**: Navigate to any lesson page and click the "Present" button (🎭)
51+
2. **Keyboard Shortcut**: Press `P` on any lesson page to toggle presentation mode
52+
3. **Exit**: Press `ESC` or click the close button (✕)
53+
54+
### Speaker Notes
55+
56+
Press `S` while in presentation mode to open the speaker notes view, which shows:
57+
58+
- Talking points for current slide
59+
- Timing guidance
60+
- Discussion prompts
61+
- Real-world context
62+
- Transition notes for next slide
63+
64+
## Slide Types
65+
66+
The AI generates different slide types based on content:
67+
68+
### 1. Title Slide
69+
- Lesson title and subtitle
70+
- Learning objectives
71+
- Estimated duration
72+
73+
### 2. Concept Slide
74+
- Key idea with 3-5 bullet points
75+
- Progressive reveal (fragment animation)
76+
- Used for main teaching points
77+
78+
### 3. Code Example Slide
79+
- Syntax-highlighted code block
80+
- Caption explaining purpose
81+
- Up to 15 lines for readability
82+
83+
### 4. Comparison Slide
84+
- Side-by-side ineffective vs effective patterns
85+
- Color-coded (red for bad, green for good)
86+
- Shows contrast between approaches
87+
88+
### 5. Visual Slide
89+
- Custom React components (CapabilityMatrix, UShapeAttentionCurve, etc.)
90+
- Interactive visualizations
91+
- Caption explaining the visual
92+
93+
### 6. Key Takeaway Slide
94+
- Summary of section or lesson
95+
- 3-5 main points
96+
- Reinforces learning objectives
97+
98+
## Customization
99+
100+
### Disable Presentation for a Lesson
101+
102+
Add to frontmatter:
103+
104+
```yaml
105+
---
106+
title: "Lesson Title"
107+
presentation: false # Hides presentation button
108+
---
109+
```
110+
111+
### Reveal.js Configuration
112+
113+
Edit `RevealSlideshow.tsx` to customize:
114+
115+
```typescript
116+
const deck = new Reveal(deckRef.current, {
117+
width: 1280, // Presentation width
118+
height: 720, // Presentation height
119+
transition: 'slide', // Transition effect
120+
slideNumber: 'c/t', // Current/total slide numbers
121+
// ... more options
122+
});
123+
```
124+
125+
## AI Prompt Design
126+
127+
The presentation prompt focuses on:
128+
129+
1. **Condensation**: 8-15 slides per lesson (vs 50+ paragraphs in docs)
130+
2. **Visual Focus**: Bullet points, not paragraphs
131+
3. **Speaker Notes**: Detailed talking points for instructor
132+
4. **Code Selection**: Only most illustrative examples
133+
5. **Logical Flow**: Clear transitions between concepts
134+
135+
### Prompt Structure
136+
137+
```
138+
TASK: Convert technical course material into presentation format
139+
140+
TARGET AUDIENCE: Senior software engineers (3+ years)
141+
142+
PRESENTATION STRUCTURE:
143+
✓ Create 8-15 slides total
144+
✓ Each slide covers ONE key concept
145+
✓ Use bullet points (3-5 per slide)
146+
✓ Include speaker notes with timing, discussion prompts
147+
✓ Preserve important code examples
148+
✓ Identify visual components to use
149+
150+
OUTPUT FORMAT: Valid JSON with metadata and slides array
151+
```
152+
153+
## Output Structure
154+
155+
### Manifest File
156+
157+
Located at:
158+
- `scripts/output/presentations/manifest.json` (build-time)
159+
- `website/static/presentations/manifest.json` (deployed)
160+
161+
```json
162+
{
163+
"intro.md": {
164+
"presentationUrl": "/presentations/intro.json",
165+
"slideCount": 12,
166+
"estimatedDuration": "30-45 minutes",
167+
"title": "AI Coding for Senior Engineers",
168+
"generatedAt": "2025-01-09T12:00:00.000Z"
169+
}
170+
}
171+
```
172+
173+
### Presentation File
174+
175+
Example: `website/static/presentations/intro.json`
176+
177+
```json
178+
{
179+
"metadata": {
180+
"title": "AI Coding for Senior Engineers",
181+
"lessonId": "intro",
182+
"estimatedDuration": "30-45 minutes",
183+
"learningObjectives": [
184+
"Understand the operator mindset for AI coding",
185+
"Identify when to use agents vs write code manually",
186+
"Apply Plan-Execute-Validate methodology"
187+
]
188+
},
189+
"slides": [
190+
{
191+
"type": "title",
192+
"title": "AI Coding for Senior Engineers",
193+
"subtitle": "Master AI-assisted software engineering",
194+
"content": [],
195+
"speakerNotes": {
196+
"talkingPoints": "Welcome students...",
197+
"timing": "2 minutes",
198+
"discussion": "Ask about their experience...",
199+
"context": "This course was built using the same techniques...",
200+
"transition": "Let's start by understanding the problem..."
201+
}
202+
},
203+
{
204+
"type": "concept",
205+
"title": "The Operating Model Problem",
206+
"content": [
207+
"AI coding assistants are production-standard in 2025",
208+
"Most developers hit frustration wall within weeks",
209+
"Wrong mental model: treating AI as junior developer",
210+
"Correct model: AI agents are CNC machines for code"
211+
],
212+
"speakerNotes": { ... }
213+
}
214+
]
215+
}
216+
```
217+
218+
## Keyboard Shortcuts
219+
220+
- **P** - Toggle presentation mode
221+
- **Arrow Keys** - Navigate slides (Reveal.js)
222+
- **S** - Open speaker notes view
223+
- **ESC** - Exit presentation mode
224+
- **F** - Fullscreen (browser)
225+
- **O** - Overview mode (see all slides)
226+
227+
## Best Practices
228+
229+
### For Content Authors
230+
231+
1. Write detailed lesson content - AI will condense it
232+
2. Use clear headings (H2) to structure sections
233+
3. Include code examples with context
234+
4. Add admonitions (:::tip, :::warning) for important points
235+
5. Use visual components where appropriate
236+
237+
### For Instructors
238+
239+
1. Review speaker notes before class
240+
2. Practice timing on key concepts
241+
3. Use discussion prompts to engage students
242+
4. Reference real-world examples from speaker notes
243+
5. Adjust pace based on student questions
244+
245+
### For Maintenance
246+
247+
1. Regenerate presentations after lesson updates
248+
2. Test presentation display on classroom projector
249+
3. Verify code examples are readable from distance
250+
4. Check that visual components render correctly
251+
5. Review speaker notes for accuracy
252+
253+
## Troubleshooting
254+
255+
### Presentation button doesn't appear
256+
257+
1. Check manifest exists: `website/static/presentations/manifest.json`
258+
2. Verify lesson path matches manifest key
259+
3. Ensure `presentation: false` is not in frontmatter
260+
4. Check browser console for errors
261+
262+
### Slides don't render correctly
263+
264+
1. Verify JSON structure is valid
265+
2. Check that visual component names match imports
266+
3. Test with simpler slide type first
267+
4. Review Reveal.js console errors
268+
269+
### Speaker notes missing
270+
271+
1. Ensure speakerNotes field exists in JSON
272+
2. Check that all required fields are present
273+
3. Press `S` to toggle speaker view
274+
4. Verify browser allows popups (for separate speaker window)
275+
276+
### Code examples too long
277+
278+
1. Edit JSON to shorten code
279+
2. Regenerate with updated lesson content
280+
3. Split into multiple code slides
281+
4. Use caption to reference full code in docs
282+
283+
## Development
284+
285+
### Adding New Slide Types
286+
287+
1. Add type to TypeScript interface in `RevealSlideshow.tsx`
288+
2. Implement render case in `renderSlide()` function
289+
3. Add CSS styling in `RevealSlideshow.module.css`
290+
4. Update AI prompt to generate new type
291+
5. Test with sample lesson
292+
293+
### Modifying AI Prompt
294+
295+
Edit `buildPresentationPrompt()` in `generate-presentation.js`:
296+
297+
```javascript
298+
function buildPresentationPrompt(content, fileName, outputPath) {
299+
return `You are a presentation script writer...
300+
301+
TASK: Convert technical course material...
302+
303+
PRESENTATION STRUCTURE REQUIREMENTS:
304+
✓ DO: Create 8-15 slides total
305+
✓ DO: Each slide should cover ONE key concept
306+
// ... add your requirements
307+
308+
OUTPUT FORMAT: Valid JSON...`;
309+
}
310+
```
311+
312+
## Performance
313+
314+
- **Generation Time**: 30-60 seconds per lesson (depends on length)
315+
- **Bundle Size**: Reveal.js adds ~60KB gzipped
316+
- **Slide Load Time**: <100ms for typical presentation
317+
- **Speaker Notes**: Minimal performance impact
318+
319+
## Future Enhancements
320+
321+
Potential improvements:
322+
323+
- [ ] PDF export for offline use
324+
- [ ] Custom themes per module
325+
- [ ] Animation library for visual elements
326+
- [ ] Live polling/quizzes embedded in slides
327+
- [ ] Screen recording mode
328+
- [ ] Accessibility improvements (ARIA labels, high contrast)
329+
- [ ] Mobile presenter remote control
330+
- [ ] Auto-advance with timings
331+
- [ ] Slide annotations/drawing tools

0 commit comments

Comments
 (0)