Find missing chapters with bookdown

This warning is very helpful but also frustrating... is there any way to find out which two .Rmds are missing first-level headings? (For the record, I did not write 72 chapters, this is a class project.)

Warning message:
In split_chapters(output, gitbook_page, number_sections, split_by,  :
  You have 72 Rmd input file(s) but only 70 first-level heading(s). Did you forget first-level headings in certain Rmd files?

Update: this was a false alarm... I changed two .Rmds to child documents while the book was rendering, creating a difference in count between _bookdown.yml at the time rendering began, and the file count when render got to that point. Still, it would be helpful to know the answer for future reference.

1 Like

This does the trick:

readLines("_bookdown.yml") %>%
  str_extract_all("[A-z0-9_-]+.Rmd") %>%  # adjust as necessary...
  unlist() %>%
  map_chr(readLines, n = 1)
1 Like

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.