Autoflow rule: bare-image-position-variation
Priority 70 · A bare  with more than 8 words varies position across the deck: inline → left → right. With fewer words it becomes a filtered hero background.
This is the only rule that uses cross-slide state. Every other rule treats each slide independently. This one looks at the position used for the previous bare image in the deck and picks the next position in the cycle.
The name says “position variation” because it varies the image position across slides — it doesn’t rotate the image itself.
When it fires
Section titled “When it fires”- The slide has exactly 1 image with no layout modifier
(no
right/left/inline/qr/fit/filtered/bg/bordered) - The slide has more than 8 words of text beside it
With 8 words or fewer, the slide is a hero instead: the image becomes a
![filtered] background (dark overlay) and the words go through the text
rules on top of it — usually a big #[fit] statement. The threshold is
heroMaxWords in the autoflow config.
What it does
Section titled “What it does”The rule reads ctx.state.lastBareImagePosition and picks the next
position in the cycle:
1st bare image in deck → inline (image in flow, source order)2nd bare image in deck → left (split, image left + text right)3rd bare image in deck → right (split, image right + text left)4th → inline, 5th → left, 6th → right, ...inline stacks image and text in one column, so it’s only picked when the
text is at most two lines (a title and one line). With more text the
variation alternates left / right.
All three are existing parser primitives — the rule rewrites the bare
 into one of  /  / 
and the parser handles the rest.
The variation persists across the entire deck via ctx.state, not
just within the current slide. Even if other rules fire between two
bare-image slides, the variation continues from where it left off.
Cross-slide observation: explicit images count too
Section titled “Cross-slide observation: explicit images count too”The rule’s observe hook runs on every slide — even ones autoflow
skips (because of #[fit], code blocks, etc) — and records explicit
![left] / ![right] / ![inline] images as if the variation had picked
that position.
Why: a user-placed  and a bare 
on the next slide should not both end up on the left. Without this
observation, the bare-image variation would happily ignore the explicit
one and could pick the same position. With it, the rule treats explicit
and bare images as one continuous variation history.
Concrete example:
slide 1:  → rule rewrites to  (lastPosition = inline)slide 2:  → explicit, left as written; observed (lastPosition = left)slide 3:  → rule picks NEXT after left = right (lastPosition = right)Slide 3 would have been left again without the observation step.
Why this rule
Section titled “Why this rule”Without it, an author with several plain  slides would have to
manually decide a position for each one. Forgetting to vary results in
every photo on the same side, which feels mechanical. The variation gives
natural rhythm without any thinking from the author.
Live fixture
Section titled “Live fixture”The fixture below has 4 bare-image slides in a row: inline → left → right, then a hero (a few words over the image).
Source
Section titled “Source”footer: autoflow rules · bare-image-position-variationslidenumbers: trueautoflow: truetheme: nordicscheme: 1
# Cover
(slide 0 — sets up the deck before the variation begins)
---
<!--RULE: bare-image-position-variation (priority 70)TRIGGERS WHEN: - The slide has exactly 1 image with NO layout modifier (no right/left/inline/qr/fit/filtered/bg/bordered) - The slide has MORE text than a hero slide holds (> 8 words). With 8 words or fewer, the image becomes a ![filtered] background instead (the bare-image-background preprocessor) — see the last slide.EFFECT (history-based): - Picks position by varying across deck: inline → left → right → ... - inline only when the text is at most 2 lines (title + one line); with more text it alternates left/right so nothing gets pushed off - The position is based on ctx.state.lastBareImagePosition, NOT slide index - Rewrites the bare  into a parser primitive: , ,  - State is also updated when an EXPLICIT ![left]/![right]/![inline] image appears on any slide, so neighbors never repeat a side.
The name says "position variation" because it varies the IMAGE POSITIONacross slides — it doesn't rotate the image itself.
slide 1: 1st bare image → inline (title + one line) slide 2: 2nd bare image → left slide 3: 3rd bare image → right slide 4: a few words → hero (filtered background), not a position-->

# First image of the deck
A title and one line of text: the image goes inline.
---

# Second image
More text than a hero slide holds,so the image takes the left half of a split.
---

# Third image
The next one alternates to the right,so neighboring slides never repeat a side.
---

You are not paidto write code.Future enhancement
Section titled “Future enhancement”A planned upgrade: measure the image at render time (naturalWidth/Height)
and prefer portrait → split vs landscape → inline hero instead of
strict round-robin variation. The CSS classes would be applied via a small
JS helper in js/render.js, not in autoflow itself (which is sync
markdown→markdown). Tracked in the roadmap.