r-wasm / quarto-drop

Drop down an interactive R or Python console, code editor, and plotting window from the top of your Quarto slides.
https://r-wasm.github.io/quarto-drop/
MIT License
157 stars 4 forks source link

Quarto Drop plugin for reveal.js

Have you ever given a talk or presentation and wanted an R or Python console right there in your slides for some quick throwaway examples or demos? Do you find switching to another window or desktop so that you can show some work in an IDE fiddly and distracting?

If so, this plugin is for you! With Quarto Drop, you can press a shortcut key to immediately drop down from the top of the slide an interactive R or Python console, editor and plotting window. The same shortcut key then dismisses the console.

Show your demo then dismiss the console. Later, on another slide, you can drop it down again and state is maintained over multiple slides.

Code execution is powered by WebAssembly, using webR and Pyodide. No R or Python execution servers are required.

Usage

  1. Install the Quarto Drop extension:
quarto add r-wasm/quarto-drop
  1. Add the plugin to your reveal.js slides, as part of your yaml header:
---
format: revealjs
revealjs-plugins:
  - drop
---
  1. During the presentation, press the drop shortcut. By default, it is the backtick key: "`". Alternatively, press the console button at the bottom left of the slide.

Demo

Example slides:

Configuration

Change the shortcut key and console button visibility:

format:
  revealjs:
    drop:
      shortcut: "]"
      button: false

Execute Python code

format:
  revealjs:
    drop:
      engine: pyodide

Load packages automatically on page load

format:
  revealjs:
    drop:
      engine: webr
      webr:
        packages:
          - ggplot2
          - dplyr