我正在尝试使用以下结构
bookdown-project
*.yml
*.sh
*.css
content/*.Rmd
content/diagrams/*.png
_bookdown.yml
book_filename: "demo"
language:
ui:
chapter_name: ""
number_sections: false
numbering: false
rmd_subdir: ["content"]
delete_merged_file: true
运行bookdown渲染将提供以下输出
> bookdown::render_book("content/index.Rmd", "bookdown::gitbook")
> Error in bookdown::render_book("content/index.Rmd",
> "bookdown::gitbook") : No input R Markdown files found from the
> current directory /Users/Jerry/Code/bookdown-project or in the
> rmd_files field of _bookdown.yml
所以我使用了如下的rmd_files选项
_bookdown.yml
book_filename: "demo"
language:
ui:
chapter_name: ""
number_sections: false
numbering: false
rmd_subdir: true
rmd_files: ["content/index.Rmd", "content/01-intro.Rmd", "content/02-features.Rmd", "content/03-modules.Rmd"]
delete_merged_file: true
已生成书籍,但缺少参考的图像文件。
例如在content / 02-features.Rmd中,我有以下一行
![](diagrams/feature-mindmap.png)
但是我注意到图像没有被复制。如果将如下所示的图表文件夹上移到根目录,则这些图表将以呈现的格式显示。
bookdown-project
content/*.Rmd
diagrams/*.png
这可行,但是会破坏文件的相对位置。
如果可以像下面那样设置内容根目录,并且所有文件都采用相对路径,则将书本的配置与正在写入的实际内容分开会更容易。也许已经存在了,但是我找不到它。我尝试过
content_root: ["content"]
devtools::session_info('bookdown')
Session info -------------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.5.1 (2018-07-02)
system x86_64, darwin17.6.0
ui RStudio (1.2.830)
language (EN)
collate C
tz Asia/Kolkata
date 2018-08-24
Packages -----------------------------------------------------------------------------------------------------------------------------
package * version date source
backports 1.1.2 2017-12-13 CRAN (R 3.5.1)
base64enc 0.1-3 2015-07-28 CRAN (R 3.5.1)
bookdown 0.7.17 2018-08-24 Github (rstudio/bookdown@4f9d73d)
digest 0.6.15 2018-01-28 CRAN (R 3.5.1)
evaluate 0.11 2018-07-17 CRAN (R 3.5.1)
glue 1.3.0 2018-07-17 CRAN (R 3.5.1)
graphics * 3.5.1 2018-07-03 local
grDevices * 3.5.1 2018-07-03 local
highr 0.7 2018-06-09 CRAN (R 3.5.1)
htmltools 0.3.6 2017-04-28 CRAN (R 3.5.1)
jsonlite 1.5 2017-06-01 CRAN (R 3.5.1)
knitr 1.20 2018-02-20 CRAN (R 3.5.1)
magrittr 1.5 2014-11-22 CRAN (R 3.5.1)
markdown 0.8 2017-04-20 CRAN (R 3.5.1)
methods * 3.5.1 2018-07-03 local
mime 0.5 2016-07-07 CRAN (R 3.5.1)
Rcpp 0.12.18 2018-07-23 CRAN (R 3.5.1)
rmarkdown 1.10 2018-06-11 CRAN (R 3.5.1)
rprojroot 1.3-2 2018-01-03 CRAN (R 3.5.1)
stats * 3.5.1 2018-07-03 local
stringi 1.2.4 2018-07-20 CRAN (R 3.5.1)
stringr 1.3.1 2018-05-10 CRAN (R 3.5.1)
tinytex 0.7 2018-08-22 CRAN (R 3.5.1)
tools 3.5.1 2018-07-03 local
utils * 3.5.1 2018-07-03 local
xfun 0.3 2018-07-06 CRAN (R 3.5.1)
yaml 2.2.0 2018-07-25 CRAN (R 3.5.1)