Skip to content

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.

Rules are tried in priority order. Lower number = tried first.

PriorityRuleWhen it fires
Skip checksSlide already has explicit directives, code, or custom blocks → bypass everything
10TitleFirst slide, short headline + longer subtitle
20Divider1-2 word standalone slide
30Diagonal2 short paragraphs, one ending in ?
40Z-PatternExactly 4 short paragraphs
50Alternating colors3+ short paragraphs
60Statement1-4 short lines, ≤8 words each
70Bare image position variation1 bare ![](src) + text — varies inline → left → right across deck (history-based)
75Phrase + bullets paletteHeadline + 2-3 short bullets — cycles through 4 layouts (cards/pills/alternating/staggered)
80Autoscale9+ lines or 80+ words (safety net for long slides)

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.

  • 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 ![](src) 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.