Richard Yang
Richard Yang

Reputation: 53

Issue with Host R bookdown generated gitbook on sharepoint

I am trying to establish a workflow to host bookdown generated gitbook on Sharepoint (main content publishing platform within corporate). With some tweaks, we can the gitbook on the sharepoint and have no issues with embedded ploty figures.

However, all the figures saved on sub folders could not be displayed. It was found that SharePoint added "_" to the "_main_files" automatically as "files" was reserved for system.

There is some option within _bookdown.yml to config the outputdir such as output_dir: "Outputfolder". However, the "_files" is still automatically added for the folder that saves image.

Is there a work around with bookdown config to change the sub-directory? A folder name like "_main_images" would not conflict with sharepoint naming convention.

Upvotes: 3

Views: 374

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30114

You can set the figure path using the knitr chunk option fig.path in the first code chunk of your book, e.g.,

```{r include=FALSE}
knitr::opts_chunk$set(fig.path = '_main_images/')
```

I'm not entirely sure about the consequences of changing the default fig.path, but if your book only contains R plots and no HTML widgets, this change should be fine.

Upvotes: 4

Related Questions