Closed
Description
Checklist
Have you:
formatted your issue so it is easier for us to read?
included a minimal, self-contained, and reproducible example?
pasted the output from
xfun::session_info('bookdown')
in your issue?upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?
installed and tested your bug with the development version of the bookdown package using
remotes::install_github("rstudio/bookdown")
?
Steps to reproduce the problem
- Create a New Project in R Studio: New Directory | Book project using Bookdown | Directory Name = Test | HTML Book Format = gitbook
- Create New Directory = "Rmd" inside the Project directory
- Add this Directory in file "_bookdown.yml" by adding 'rmd_subdir: ["Rmd"]' without single quotes
- Create File: Test/Rmd/08-Chapter.Rmd
- File Contents are given below
# Chapter inside Sub-directory
- Building complete book, using "Ctrl+ Shift+ B", works for both v0.25 & v0.26
- However, knitting a single Rmd file inside a sub-directory, using "Ctrl+ Shift+ K", does not work
- In v0.25, output is a working html file
- In v0.26, there is an error
```{r 'Test-Chunk'}
print("v0.26: It works when building the book but does not work when knitting a single chapter.")
```
```{r 'Version'}
# Package Version
packageVersion("bookdown")
# Session Info
sessionInfo()
```
- As said above, Building the book works but knitting this standalone chapter throws following error
Error in if (grepl("(html|gitbook)", format)) return("html") :
argument is of length zero
Calls: <Anonymous> ... <Anonymous> -> <Anonymous> -> render_book -> target_format
Execution halted
Observations:
- The current development version ‘0.26.1’ also produces same error.
installed using remotes::install_github('rstudio/bookdown', upgrade = TRUE)
- I have reverted back to v0.25 from the URL "https://cran.r-project.org/src/contrib/Archive/bookdown/bookdown_0.25.tar.gz".
It works and produces an HTML after knitting a single chapter inside the sub-directory.
- Note that the default Rmd files generated in the root directory e.g. "01-intro.Rmd" can be knitted without issue by the v0.26. Files inside the sub-directory are generating errors.
xfun::session_info()
#R version 4.1.3 (2022-03-10)
#Platform: x86_64-w64-mingw32/x64 (64-bit)
#Running under: Windows 10 x64 (build 19044), RStudio 2022.2.1.461
#
#Locale:
# LC_COLLATE=English_India.1252 LC_CTYPE=English_India.1252 LC_MONETARY=English_India.1252 LC_NUMERIC=C
# LC_TIME=English_India.1252
#
#Package version:
# base64enc_0.1.3 bookdown_0.26 bslib_0.3.1 cli_3.2.0 compiler_4.1.3 digest_0.6.29 evaluate_0.15
# fastmap_1.1.0 fs_1.5.2 glue_1.6.2 graphics_4.1.3 grDevices_4.1.3 highr_0.9 htmltools_0.5.2
# jquerylib_0.1.4 jsonlite_1.8.0 knitr_1.38 magrittr_2.0.3 methods_4.1.3 R6_2.5.1 rappdirs_0.3.3
# rlang_1.0.2 rmarkdown_2.13.7 sass_0.4.1 stats_4.1.3 stringi_1.7.6 stringr_1.4.0 tinytex_0.38
# tools_4.1.3 utils_4.1.3 xfun_0.30 yaml_2.3.5
Metadata
Metadata
Assignees
Type
Projects
Status
Done
Activity
cderv commentedon Apr 20, 2022
Thanks @shivam7898 for the great bug report ! I can reproduce and I believe this means that the fix fb5013f following #1324 to fix similar issue #1323 is incomplete.
I'll see what I can do to correctly handle guessing format where no
output_format
is provided.index.Rmd
file to help detect output format when none provided #1332cderv commentedon Apr 20, 2022
This should now work ok in dev version of the package.
Thanks!
github-actions commentedon Oct 19, 2022
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.