commit - bcb2ab71430e9ef8b8c9e37376d41437b962d075
commit + be287bea29d2b7f0494bc0cfb1b2bb2713a31b98
blob - a5aeff82ee80eb01d2b52f5fa9d8eb2728087122
blob + 741f9b276a37a7b8fb18170ef6e3084d97843096
--- examples/julia.md
+++ examples/julia.md
lines!(ax, 1:100, x -> x^2)
save("fig.png", fig)
```
+
+---
+
+### An animated GIF from code
+
+A saved `.gif` is displayed the same way any other executed-code image
+is -- and if it has more than one frame, it plays back in a loop just
+like a `.gif` referenced directly in markdown.
+
+```julia
+using Plots
+gr()
+anim = @animate for i in 1:40
+ plot(1:100, x -> sin(x / 10 + i / 4), ylim=(-1.2, 1.2), legend=false)
+end
+gif(anim, "wave.gif", fps=20)
+```
blob - 06971dd83e430fd638a39992dd0d7f24c60c8c31
blob + 2e01e0a3fa3793d83c1b18981913c91b5f1248aa
--- internal/model/model.go
+++ internal/model/model.go
slide, err := r.Render(slide)
slide = strings.ReplaceAll(slide, "\t", tabSpaces)
if includeVirtualText {
- slide += m.VirtualText
+ if m.VirtualText != "" {
+ // Centered the same way images are (via their own PadLeft),
+ // so text-only output -- UnicodePlots' terminal-drawn charts,
+ // in particular -- lines up with the image-based plots
+ // instead of hugging the left edge.
+ slide += lipgloss.PlaceHorizontal(contentWidth, lipgloss.Center, m.VirtualText)
+ }
if m.executing {
slide += "\n" + spin + " ejecutando…"
}