Autoflow Rules
Autoflow runs a small set of rules over each slide. The first rule whose predicate matches wins. Each rule injects directives the parser already understands — autoflow never invents new content.
Every page in this section embeds a live fixture deck that demonstrates
exactly when the rule fires. The same .md file is used by the test
suite: if a rule breaks in the engine, the test fails AND the fixture
stops looking right. Single source of truth.
Pipeline order
Section titled “Pipeline order”Rules are tried in priority order. Lower number = tried first.
| Priority | Rule | When it fires |
|---|---|---|
| — | Skip checks | Slide already has explicit directives, code, or custom blocks → bypass everything |
| 10 | Title | First slide, short headline + longer subtitle |
| 20 | Divider | 1-2 word standalone slide |
| 30 | Diagonal | 2 short paragraphs, one ending in ? |
| 40 | Z-Pattern | Exactly 4 short paragraphs |
| 50 | Alternating colors | 3+ short paragraphs |
| 60 | Statement | 1-4 short lines, ≤8 words each |
| 70 | Bare image position variation | 1 bare  + text — varies inline → left → right across deck (history-based) |
| 75 | Phrase + bullets palette | Headline + 2-3 short bullets — cycles through 4 layouts (cards/pills/alternating/staggered) |
| 80 | Autoscale | 9+ lines or 80+ words (safety net for long slides) |
How rules are written
Section titled “How rules are written”Every rule is a plain JavaScript object in autoflow.js:
{ name: 'divider', priority: 20, match(info, ctx) { return info.contentLines.length === 1 && wordCount(info.contentLines[0]) <= 2; }, transform(info, ctx) { const w = info.contentLines[0].trim(); return { lines: ['[.heading-align: center]', `#[fit] ${w}`], detail: '1 word', }; },}The match(info, ctx) predicate gets a rich info object (paragraphs,
images, totalWords, etc) and a ctx that carries state across slides
(like which side the last bare image landed on, or how many slides ago a
particular rule fired). This is what lets bare-image-rotate rotate across
a whole deck instead of treating each slide in isolation.
Adding a rule = adding one object. The order is determined by priority.
Browse the rules
Section titled “Browse the rules”- Skip checks — When autoflow does NOTHING — explicit directives, code, custom blocks.
- Title — First slide gets a centered #[fit] title with subtitle below.
- Divider — A 1-2 word slide becomes a giant section break.
- Diagonal — Two short paragraphs (one ending in ?) get pulled across the slide.
- Z-Pattern — Four short paragraphs land at the four corners of the slide.
- Alternating colors — 3+ short paragraphs alternate between heading color and accent.
- Statement — 1-4 short lines (≤8 words each) get the #[fit] treatment.
- Bare image position variation (history-based) — A bare  varies position across the deck: inline → left → right → ...
- Phrase + bullets (palette) — Headline + 2-3 short bullets cycles through 4 layouts: cards → pills → alternating → staggered.
- Autoscale (safety net) — Long slides (9+ lines OR 80+ words) shrink to fit.