Check whether slide decks are still in step with their chapters
Source:R/slides.R
check_slides_sync.RdCompares the structure hash recorded in each deck against its chapter's current structure, and reports which decks have drifted. Because the hash covers headings and code only, editing a chapter's prose does not flag its deck — adding, removing, renaming or reordering a section does.
Value
Invisibly, a data frame with one row per deck: slides, chapter,
and status, which is one of "ok", "stale", "missing chapter" or
"not generated".
Details
Deliberately reports rather than regenerates: a stale deck usually needs a judgement call, not an overwrite.
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/file1a723251b4d9.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a723251b4d9/project-organisation.qmd.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a723251b4d9/code-style-and-readability.qmd.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a723251b4d9/writing-readable-code.qmd.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a723251b4d9/writing-functions.qmd.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a723251b4d9/writing-a-reprex-getting-unstuck.qmd.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a723251b4d9/putting-it-all-together.qmd.
draft_slides(file.path(book, "project-organisation.qmd"), dir = slides)
#> ✔ Created /tmp/Rtmpe7cYU7/file1a7256685c41.
#> ✔ Wrote /tmp/Rtmpe7cYU7/file1a7256685c41/project-organisation.qmd.
check_slides_sync(book, slides)
#> ✔ /tmp/Rtmpe7cYU7/file1a7256685c41/project-organisation.qmd is in step.