Quick start¶
How it works¶
- Build slides with
Slide()for title, bullets, code, fragments, backgrounds - Build the deck with
Presentationfor theme, plugins, default background - Add slides with
deck.add(slide, …)and export withdeck.save("deck.html")
PyReveal is a backward-compatible alias for Presentation.
1. Create slides¶
Each slide is a Slide() object. Set content with methods or assignment:
from pyreveal import Slide
intro = Slide()
intro.title = "Welcome to PyReveal"
intro.subtitle("Build decks in Python")
agenda = Slide()
agenda.heading("Agenda")
agenda.bullets(["Introduction", "Demo", "Q&A"])
2. Vertical slides (reorderable list)¶
Vertical children live on slide.vertical as a list you can reorder:
first = Slide.make_text("First vertical slide")
second = Slide.make_text("Second vertical slide")
intro.vertical = [first, second]
intro.vertical = [second, first] # swap order
You can also assign plain strings; they become text slides automatically:
Or build a section in one call:
3. Add slides to the deck¶
from pyreveal import Plugin, Presentation, Slide, Theme, Transition
intro = Slide()
intro.title = "Welcome"
intro.subtitle("Build decks in Python")
intro.vertical = [
Slide.make_text("First point"),
Slide.make_text("Second point"),
]
photo = Slide()
photo.heading("Photo background")
photo.bg("path/to/image.jpg")
deck = (
Presentation("My Presentation", theme=Theme.BLACK, transition=Transition.SLIDE)
.configure(hash=True, progress=True, slideNumber="c/t")
.plugins(Plugin.NOTES)
.add(intro, agenda, photo)
.save("my_presentation.html")
)
Open presentations/my_presentation.html in a browser. The output folder also contains copied revealjs/ assets.
Typed choices¶
Prefer enums over raw strings for themes, transitions, plugins, and effects:
from pyreveal import Plugin, Theme, Transition
Presentation("Talk", theme=Theme.DRACULA, transition=Transition.FADE)
.plugins(Plugin.NOTES, Plugin.HIGHLIGHT)
See Choices for the full list.
HTML escape hatch¶
You do not need HTML for normal slides. When needed:
Plain strings without tags become paragraphs: Slide("Just text").
Explore the documentation¶
| Topic | Guide |
|---|---|
| Install | Installation |
| Slides & vertical stacks | Slides |
| Typed enums | Choices |
| Backgrounds | Backgrounds |
| Fragments & auto-animate | Fragments |
| Plugins, code, math | Plugins · Math |
| Reveal.js parity | Feature support |
| Themes & Reveal.js config | Configuration |
| Layouts & elements (advanced) | Layouts · Elements |
| Full API | API reference |
Examples in the repository¶
Build the demo deck (mirrors the official reveal.js demo):
Open http://localhost:8765/demo.html in your browser. Serve over HTTP so reveal.js plugins and remote demo assets load correctly.
Versioning¶
Documentation is versioned with mike. Use the version selector in the header to switch between releases. See Documentation versioning for publishing.