Awesome thanks. I will look into relaxing the constraint. I am suprised it is creating an error.
I still can't explain why this happens.
If source-posts is a directory in your project where you call render_book(), we should identify it as such and look for index.Rmd into it. so that input = "index.Rmd" and working directory change to be source-posts for the time of the rendering. (render_book() works from within the book source directory)
But is seems something is not right because you get that
The first repo BasicWebsite-Rmarkdown shows my file structure and organizational thought process and successfully uses without error an R-script with render_site. I wrote a recent blog post on this topic as a README. This minimal working example showed to me proof-of-concept that I could hopefully write a blog with my existing skills in RMarkdown and YAML. I then extended these new skills to render_book and my blog.
The second repo BasicWebsite-WithPosts-Rmarkdown shows a minimal working example of my thought process in the final creation of my Jason M. Osborne Blog.
The single post writing and rendering with Bookdown worked in bookdown_0.26 but broke in bookdown_0.27 due to
Error in stop_if_not_exists(input) :
Some files were not found: ./source-posts
I hope this second minimal working example helps y'all identify the error and a possible solution. As stated in the commit message of BasicWebsite-WithPosts-Rmarkdown , the file structure is source-body which renders via a R-script using render_site to a self-contained output folder while source-post renders via render_book (singlePost renderscript) to a self-contained folder output/posts. Again, this solution worked in 0.26 but not 0.27 because of the above message.
All of the, hopefully, full functioning repos were created on my laptop whose sessionInfo() is
R version 4.1.3 (2022-03-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6
other attached packages:
[1] bookdown_0.26
loaded via a namespace (and not attached):
[1] digest_0.6.29 R6_2.5.1 jsonlite_1.8.0 magrittr_2.0.3 evaluate_0.15 highr_0.9
[7] stringi_1.7.6 rlang_1.0.2 jquerylib_0.1.4 bslib_0.3.1 rmarkdown_2.13 tools_4.1.3
[13] stringr_1.4.0 xfun_0.30 yaml_2.3.5 fastmap_1.1.0 compiler_4.1.3 htmltools_0.5.2
[19] knitr_1.38 sass_0.4.1
I hope that the information I have provided is what you need. This is my first time communicating about something this technical before. I am still pretty new to R, Rmarkdown, and Git so please let me know if there is anything else you need to help debug this error.
Best,
Jason M. Osborne
mathematician + educator + creative tinkerer + writer
Thanks for sharing theses examples. I'll look into it closer. There is a WIP PR to relax as we could this index.Rmd constraint
I'll see how this works with your use case.
you example helped me to understand that you are using bookdown to create a website which is not necessarly a book structure, and even using bookdown to create a blog like structure.
I just wanted to add that design of bookdown project and features are really for book structure, i.e HTML websites which are mainly one big document splitted in several files as chapters or sections. In the R Markdown ecosystem, we have other tools like distill or blogdown which are more suited for project which are posts / articles that leave together in the same website and that can be render independently of each other. This is a big difference as for example, bookdown is no made so that a single Rmd file of the project can be rendered independently of other files. It is really made to render the whole book.
I'll see what I can do restore the old behavior without reverting some necessary fix for Book project.
Glad the example helped.
Thanks also for your efforts and offer to explore a fix.
My thinking was that eventually, "posts-like-documents" might need to be combined to into an actual (html or epub or gitbook) "book" so I went with Bookdown.
I also thought a "book" should be able to be a book of one .Rmd which is how initially I am using it. Eventually I will combine one .Rmd into several .Rmd so that is why I went with Bookdown.
If the output format html_document2 had respected the output_dir option of render_book script then perhaps I wouldn't have needed to "mis-use" bookdown? Again in my mathematics style writing I needed the @ref referencing feature of bookdown and the html and epub output of bookdown, so I gravitated to Bookdown.
All roads seemed to lead to Bookdown, and to my understanding and reading everything I was trying seemed to be in the Bookdown wheelhouse.
To clarify: You are saying that you can only reproduce my error if you remove the index.Rmd file from the source-posts folder?
In other words, the source-posts files in the Bitbucket repo BasicWebsite-WithPosts-Rmarkdown, worked for you with no modification, and rendered with renderscript_singlePost.r without error?
I just had the chance to re-run the renderscript that was the source of the trouble in the OP and I can confirm on my end that everything seems to be working again. I can confirm that I was on bookdown 0.27, so I am assuming that some of the "relaxations" you discussed in this thread were put into place.
Thank you for your efforts and I look forward to getting back to work learning R/RMarkdown/Bookdown.
@jason.m.osborne Current dev version of bookdown should now bring back the previous behavior that you are leveraging.
The PR has been merged
Reminder of our recommandation though for best workflow
Using index.Rmd in all bookdown project is still the recommendation
Using bookdown::render_book() with bookdown projects and bookdown format
Using rmarkdown::render() with single format document even when using document bookdown format (like bookdown::html_document2 or `bookdown::pdf_document2)