Skip to content

Prototype single files for web and slides#7

Draft
willgearty wants to merge 5 commits into
mainfrom
single-file-prototype
Draft

Prototype single files for web and slides#7
willgearty wants to merge 5 commits into
mainfrom
single-file-prototype

Conversation

@willgearty

@willgearty willgearty commented Jul 14, 2026

Copy link
Copy Markdown
Member

This introduces some infrastructure to make a single longform module quarto file render well for both a webpage (html) and for slides (revealjs). At the moment it uses no external extensions.

There are two components:

  1. web_and_slides.R: this script can be used to convert a standard longform quarto file to one that supports webpage/slides rendering
    • wraps each paragraph in ::: {.narration}, which is treated as notes for revealjs and as normal prose for html
    • adds the web_and_slides.lua filter to the yaml front matter if it isn't there (see # 2 below)
    • adds execute: output-location: fragment and execute: echo: true to the yaml front matter; this ensures that code chunk output is included in the slides and is added as fragments (separate slides) by default
    • adds revealjs.smaller = true to the yaml front matter: this ensures that figures shrink to fit on slides
    • throws a report of any headings that will end up as awkward in the slides (e.g., a # header with text after it)
    • the output can be the same as the input or they can be different (in case you want to keep the original, like in this PR as an example)
    • lives at the root of the repo
  2. web_and_slides.lua: contains various filters and processing steps that alter the way the quarto file is rendered to slides
    • handles the treatment of .narration (notes for slides, prose for webpage)
    • headings below the slide level (default is ##) are promoted so each becomes its own slide
    • back-to-back code chunks are brought in one-by-one on separate slides (like the fragment functionality)
    • back-to-back plots are split to separate slides (the prose/notes before each plot are kept with the plot)
    • callouts are converted to separate slides
    • ideally lives within each module folder (could also theoretically live at the root, but would need to be copied for each archived folder for reproducibility)

So the general workflow would look something like this:

  1. User makes original longform quarto document (as if they were making a teaching webpage)
  2. User runs the quarto document through web_and_slides.R
  3. User locally previews the rendering for both webpage and slides
  4. User removes .narration wherever text should be shown on slides verbatim
  5. User adds additional speaker notes as needed (these are never shown on the webpage format)
  6. User further adjusts the content with conditional content as needed
  7. User makes small finishing touches for either format (e.g., https://emilhvitfeldt.github.io/quarto-revealjs-editable/)

Rendered webpage:
https://palaeoverse.org/modules/pr-preview/pr-7/training/modules/ggplot/index.html

Rendered slides:
https://palaeoverse.org/modules/pr-preview/pr-7/training/modules/ggplot/index-slides.html

TODO:

  • demonstrate removing some .narration usage
  • demonstrate extra speaker notes
  • demonstrate conditional content
  • demonstrate slide formatting
  • fix reported headers

Note that the script and .lua filter were generated iteratively over the course of a substantial conversation with Claude. The original module file was made entirely by me, and I've reviewed all of the code along the way.

@github-actions

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant