I have been using Bookdown with no problems until I changed my figures to images on Imgur. The book compiles to gitbook with no problem. And individual files in the book can be rendered correctly with Pandoc to pdf. However, when I try to compile the entire book using:
I am guessing that bookdown times out when trying to retrieve the images from imgur. Is there a parameter that can be used with bookdown that will allow the integration of remote images, as pandoc does for single files?
I couldn't figure out a quick solution to your issue, but I did some investigating to figure out where things break. My main finding was that this is not a bookdown-specific issue, but appears to be a generic rmarkdown issue.
As you mentioned, pandoc can handle external images when converting from markdown to pdf. I verified this by creating a minimal markdown file that imports the external image. The output test.pdf displays the external image.
Thank you very much for clarifying this. Perhaps an rmarkdown specialist could help us with identifying the parameter(s) at fault and suggesting a fix for this, or a workaround.
Something strange is going on though. I can create the PDF using knitr::knit() followed by rmarkdown::pandoc_convert(), which is the general strategy used by rmarkdown::render(). The output test.pdf contains the image, just as expected.
Here's a reprex to demonstrate the issue:
rmd <- tempfile(fileext = ".Rmd")
md <- tempfile(fileext = ".md")
pdf <- tempfile(fileext = ".pdf")
writeLines(c(
"```{r ext-fig}",
"knitr::include_graphics(\"https://imgur.com/Kt5CR1H.jpg\")",
"```"),
con = rmd)
# This works
knitr::knit(rmd, output = md)
rmarkdown::pandoc_convert(md, to = "latex",
output = pdf,
verbose = TRUE)
# This fails
rmarkdown::render(rmd, rmarkdown::pdf_document())