Skip to content

swap reveal.js instead of swiper for slides#9166

Merged
Light2Dark merged 8 commits intomainfrom
sham/add-reveal-js
Apr 20, 2026
Merged

swap reveal.js instead of swiper for slides#9166
Light2Dark merged 8 commits intomainfrom
sham/add-reveal-js

Conversation

@Light2Dark
Copy link
Copy Markdown
Collaborator

@Light2Dark Light2Dark commented Apr 13, 2026

📝 Summary

Swap libraries from Swiper to Reveal.js for slides view. I still maintained the old components because Carousel Plugin uses them.

Screen.Recording.2026-04-14.at.12.33.05.AM.mov

Todo:

  • Update pdf export flows
  • Read mode

I've tested exporting pdf with slides, and it seems to work fine as is, even with raster-server=live. We may want to use a different approach in the future (once we support showing code inputs). I experimented with using print-pdf on the URL and it doesn't work as well in the marimo editor. But I may have another approach for us (use vertical layout instead).

Future PRs:

  • Add kitchen_sink_slides.py notebook (may do it in a follow-up b4 merging this)
  • Maintain aspect ratio for the slide viewer
  • Add sidebar to store per-slide config in reveal.js

📋 Pre-Review Checklist

  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • Video or media evidence is provided for any visual changes (optional).

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Tests have been added for the changes made.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Apr 17, 2026 5:22pm

Request Review

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Bundle Report

Changes will increase total bundle size by 225.98kB (0.91%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
marimo-esm 25.1MB 225.98kB (0.91%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: marimo-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/cells-*.js 502 bytes 703.94kB 0.07%
assets/index-*.js 213 bytes 602.31kB 0.04%
assets/index-*.css 63 bytes 362.35kB 0.02%
assets/JsonOutput-*.js 2.43kB 340.13kB 0.72%
assets/dist-*.js 92 bytes 256 bytes 56.1% ⚠️
assets/dist-*.js -119 bytes 137 bytes -46.48%
assets/dist-*.js 23 bytes 160 bytes 16.79% ⚠️
assets/dist-*.js 172 bytes 276 bytes 165.38% ⚠️
assets/dist-*.js -8 bytes 169 bytes -4.52%
assets/dist-*.js -7 bytes 176 bytes -3.83%
assets/dist-*.js -220 bytes 183 bytes -54.59%
assets/dist-*.js -283 bytes 104 bytes -73.13%
assets/dist-*.js -56 bytes 104 bytes -35.0%
assets/dist-*.js 65 bytes 169 bytes 62.5% ⚠️
assets/dist-*.js -46 bytes 137 bytes -25.14%
assets/dist-*.js -35 bytes 102 bytes -25.55%
assets/dist-*.js 2 bytes 104 bytes 1.96%
assets/dist-*.js 8 bytes 177 bytes 4.73%
assets/dist-*.js 283 bytes 387 bytes 272.12% ⚠️
assets/dist-*.js -112 bytes 164 bytes -40.58%
assets/dist-*.js 227 bytes 403 bytes 128.98% ⚠️
assets/dist-*.js -152 bytes 183 bytes -45.37%
assets/dist-*.js 166 bytes 335 bytes 98.22% ⚠️
assets/layout-*.js -309 bytes 185.6kB -0.17%
assets/reveal-*.js (New) 165.6kB 165.6kB 100.0% 🚀
assets/swiper-*.js (New) 116.4kB 116.4kB 100.0% 🚀
assets/worker-*.js 25 bytes 85.01kB 0.03%
assets/reveal-*.css (New) 54.08kB 54.08kB 100.0% 🚀
assets/file-*.js 2.36kB 49.4kB 5.03% ⚠️
assets/state-*.js 345 bytes 24.4kB 1.43%
assets/purify.es-*.js 16 bytes 21.05kB 0.08%
assets/swiper-*.css (New) 15.12kB 15.12kB 100.0% 🚀
assets/mermaid-*.core-B0EhnNjP.js (New) 2.38kB 2.38kB 100.0% 🚀
assets/slide-*.js (New) 615 bytes 615 bytes 100.0% 🚀
assets/slides-*.css -15.1kB 305 bytes -98.02%
assets/slides-*.js -116.37kB 0 bytes -100.0%
assets/mermaid-*.core-Blvy2Lmj.js (Deleted) -2.38kB 0 bytes -100.0% 🗑️

Files in assets/index-*.js:

  • ./src/plugins/layout/carousel/CarouselPlugin.tsx → Total Size: 717 bytes

Files in assets/layout-*.js:

  • ./src/components/editor/renderers/slides-layout/slides-layout.tsx → Total Size: 2.87kB

Files in assets/reveal-*.js:

  • ./src/components/slides/reveal-slides.css → Total Size: 0 bytes

  • ./src/components/slides/reveal-component.tsx → Total Size: 3.89kB

Files in assets/swiper-*.js:

  • ./src/components/slides/swiper-slides.css → Total Size: 0 bytes

  • ./src/components/slides/swiper-component.tsx → Total Size: 5.4kB

Files in assets/slides-*.js:

  • ./src/components/slides/slides.css → Total Size: 0 bytes

@Light2Dark Light2Dark added the enhancement New feature or request label Apr 13, 2026
@Light2Dark Light2Dark changed the title add reveal.js for slides swap reveal.js instead of swiper for slides Apr 13, 2026
@Light2Dark Light2Dark added the bash-focus Area to focus on during release bug bash label Apr 15, 2026
@Light2Dark Light2Dark marked this pull request as ready for review April 15, 2026 08:14
@Light2Dark Light2Dark requested review from Copilot and peter-gy April 15, 2026 08:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Swaps the notebook “slides” layout implementation from a Swiper-based deck to a Reveal.js-based deck.

Changes:

  • Added Reveal.js dependencies and introduced a new reveal-component + Reveal-specific styling.
  • Updated the slides layout renderer and e2e tests to target Reveal’s DOM structure/classes.
  • Refactored Swiper styling by moving Swiper-specific CSS into a dedicated stylesheet imported by the Swiper component.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm-lock.yaml Locks new @revealjs/react and reveal.js dependencies.
frontend/package.json Adds @revealjs/react and reveal.js to frontend dependencies.
frontend/src/components/slides/reveal-component.tsx New Reveal-based slides deck component used by slides layout.
frontend/src/components/slides/reveal-slides.css Reveal-specific CSS overrides to better match marimo styling.
frontend/src/components/editor/renderers/slides-layout/slides-layout.tsx Switches slides layout renderer to use Reveal component and maintain an external deck ref.
frontend/e2e-tests/slides.spec.ts Updates e2e assertions/navigation checks for Reveal.
frontend/src/components/slides/slides.css Removes Swiper-specific styles, keeping only shared slide layout styling.
frontend/src/components/slides/swiper-slides.css New Swiper-specific stylesheet (imports Swiper CSS + theme overrides).
frontend/src/components/slides/swiper-component.tsx Imports the new Swiper-specific stylesheet.
frontend/src/plugins/layout/carousel/CarouselPlugin.tsx Updates lazy import to point at swiper-component.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment on lines +84 to +92
<Tooltip content="Fullscreen (F)">
<Button
data-testid="marimo-plugin-slides-fullscreen"
variant="ghost"
size="icon"
className="absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-70 text-muted-foreground transition-opacity h-7 w-7"
onClick={() => {
deckRef.current?.getViewportElement()?.requestFullscreen();
}}
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fullscreen button calls requestFullscreen() unconditionally on the viewport element. In embedded/iframe contexts or browsers where fullscreen is disabled, this can throw (or reject) and create an unhandled error. Consider using useIframeCapabilities().hasFullscreen (as in swiper-component.tsx) to conditionally render/enable the button, and invoke fullscreen with a safe check (e.g., guard for element?.requestFullscreen and handle the returned promise).

Copilot uses AI. Check for mistakes.
Comment thread frontend/src/plugins/layout/carousel/CarouselPlugin.tsx
Copy link
Copy Markdown
Contributor

@peter-gy peter-gy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

I could also test some revealjs-native features like lightboxes https://revealjs.com/lightbox/, and it works out of the box, which is really cool:

Image

just by adding the data-preview-image attribute.

mo.vstack([
    mo.md("# LightBox"),
    mo.Html('<img src="https://picsum.photos/seed/vs1/2000/1500" data-preview-image />'),
])

This made me wonder if, as a follow-up, we'd want to extend mo.image to accept attributes so that when authoring slides we can do something like:

mo.image(
    "https://picsum.photos/seed/vs1/2000/1500",
    attributes={"data-preview-image": True},
)

A few other follow-up questions came to mind:

  • Should Escape toggle back to edit mode when presenting slides? I caught myself hitting Esc out of muscle memory and expected to go back to edit mode.

  • Reveal supports vertical slides (https://revealjs.com/vertical-slides/). Do we want to map notebook structure such as vertical / column layouts onto horizontal / vertical slide navigation? It could give large notebooks a minimap-like navigation like this:

@koaning could have nice use cases for it based on the columned notebook demo we've seen from him at the all hands.

  • Do we want to support revealjs plugins as a follow-up? That could give users access to nice features like Markdown slides (https://revealjs.com/markdown/) and speaker view (https://revealjs.com/speaker-view/). Or instead of having a pre-defined list, we could let users hook into the reveal init lifecycle via custom script they write e.g. in custom HTML Head of notebooks?

None of these feel blocking to me, but they seem like high-impact next steps now that the core integration is in place.


return (
<div className="group relative h-full w-full flex-1">
<Deck
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to support revealjs plugins?

Maybe a lean default set like

<Deck
  plugins={[RevealHighlight, RevealMarkdown, RevealNotes]}
...

for code highlight (https://revealjs.com/code/), reveal-native markdown rendering (https://revealjs.com/markdown/) and speaker notes (https://revealjs.com/speaker-view/)

@Light2Dark
Copy link
Copy Markdown
Collaborator Author

Light2Dark commented Apr 20, 2026

Should Escape toggle back to edit mode when presenting slides?

Yeah, I intentionally disabled it since we had the minimap, but yes I can toggle this back on.

Reveal supports vertical slides (revealjs.com/vertical-slides). Do we want to map notebook structure such as vertical / column layouts onto horizontal / vertical slide navigation? It could give large notebooks a minimap-like navigation like this:

That's interesting..This would require some brainstorming. Currently the slides are arranged linearly in cell order, so different columns would be way further down.

Do we want to support revealjs plugins as a follow-up

Yeah, that makes sense. Can add base ones. We already have marimo markdown.., but hmm. Also love if users can hook them in. Or, we could have a dropdown, and users could check which ones they'd like to add in. And we will lazily import.

Adding tickets for these

@Light2Dark Light2Dark merged commit 9691518 into main Apr 20, 2026
44 checks passed
@Light2Dark Light2Dark deleted the sham/add-reveal-js branch April 20, 2026 06:23
@github-actions
Copy link
Copy Markdown

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.2-dev55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bash-focus Area to focus on during release bug bash dependencies enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants