Rewrites the chapters: block of a Quarto book config so it matches the
outline, in order. Without this, chapters drafted by draft_book() exist as
files but are not part of the book — Quarto book projects ignore any file
that is not listed in chapters:.
Examples
book <- withr::local_tempdir()
schedule <- system.file("extdata", "schedule.md", package = "rithmatist")
create_course_book(book, open = FALSE)
#> ✔ Creating /tmp/Rtmpe7cYU7/file1a7242792b45/.
#> ✔ Setting active project to "/tmp/Rtmpe7cYU7/file1a7242792b45".
#> ✔ Creating R/.
#> ✔ Writing file1a7242792b45.Rproj.
#> ✔ Adding ".Rproj.user" to .gitignore.
#> ✔ Setting active project to "<no active project>".
#> ✔ Created course book at /tmp/Rtmpe7cYU7/file1a7242792b45.
#> • Edit schedule.md, then run `rithmatist::draft_book()`.
#> • Push to GitHub, then tick Use your GitHub Pages website in the About section.
file.copy(schedule, file.path(book, "schedule.md"), overwrite = TRUE)
#> [1] TRUE
use_chapters(file.path(book, "schedule.md"), file.path(book, "_quarto.yml"))
#> ✔ Listed 7 chapters in /tmp/Rtmpe7cYU7/file1a7242792b45/_quarto.yml.