Skip to contents

Generates the skeleton of a revealjs deck from a book chapter: the chapter title, one slide per level-two section, and any code chunks carried across verbatim. Prose is not carried over — slide text is written by hand.

Usage

draft_slides(
  chapter,
  dir = "slides",
  skip = c("Overview", "Questions"),
  overwrite = FALSE
)

Arguments

chapter

Path to a chapter .qmd.

dir

Directory to write the deck into. Created if it doesn't exist.

skip

Section headings to leave out of the deck. Defaults to the scaffolding sections draft_book() writes, which are there to organise the chapter rather than to be presented.

overwrite

Overwrite an existing deck? Defaults to FALSE, which skips it and leaves hand-written slide content untouched.

Value

Invisibly, the path to the deck.

Details

This is deliberate rather than a limitation. Long-form prose and live presentation impose different demands, and mechanically bulleting paragraphs produces the worst of both. See design/book-slides-research.md.

The deck records the chapter's structure_hash() in its front matter so that check_slides_sync() can report when the chapter has moved on.

Examples

book <- withr::local_tempdir()
slides <- withr::local_tempdir()
schedule <- system.file("extdata", "schedule.md", package = "rithmatist")
draft_book(schedule, dir = book)
#> ✔ Created /tmp/Rtmpe7cYU7/file1a727a84185f.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a727a84185f/project-organisation.qmd.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a727a84185f/code-style-and-readability.qmd.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a727a84185f/writing-readable-code.qmd.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a727a84185f/writing-functions.qmd.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a727a84185f/writing-a-reprex-getting-unstuck.qmd.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a727a84185f/putting-it-all-together.qmd.

draft_slides(file.path(book, "project-organisation.qmd"), dir = slides)
#> ✔ Created /tmp/Rtmpe7cYU7/file1a72d9186cd.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a72d9186cd/project-organisation.qmd.
cat(readLines(file.path(slides, "project-organisation.qmd")), sep = "\n")
#> ---
#> title: "Project Organisation"
#> format: revealjs
#> rithmatist:
#>   source: project-organisation.qmd
#>   structure: c90fd3732f29
#> ---
#> 
#> ## Common project structures
#> 
#> TODO: slide content.
#> 
#> ## Pitfalls of organisation
#> 
#> TODO: slide content.
#> 
#> ## Understanding file paths
#> 
#> TODO: slide content.
#> 
#> ## RStudio and positron set up
#> 
#> TODO: slide content.
#> 
#> ## "Good Enough"/Common Sense principles of project organisation
#> 
#> TODO: slide content.
#> 
#> ## Always have a README
#> 
#> TODO: slide content.
#>