Open
Description
This follows an investigation from this question
https://community.rstudio.com/t/bookdown-debugging-fixing-incomprehensible-error/87014/6
- The book start with a header h2. By default,
split_by = "chapter"
so a h1 is expected - this fails with a cryptic error (see community question) - If the book start with a header h2 but
split_by: section
is set, the render stop early because of what I believe to be a wrong check
Lines 268 to 276 in 0098721
h1 header will always be before h2 header, so if the book start with a h2 header,h12[1] != i5 + 1
will always be TRUE. I thinksort(h12)
should be done before theif
We may need to check the first header found according to split_by
split_by = "chapter"
=> h1 should be firstsplit_by = "section"
=> h1 or h2 could be first
Error message should be clear on what is expected.