有没有办法在不触及.Rmd文件的情况下渲染?

时间:2018-05-27 16:26:02

标签: r-markdown bookdown

当我使用shell中的R脚本来呈现我的bookdown文档时,

Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')"

它会触及所有.Rmd文件。有没有办法在不触摸文件的情况下进行渲染,所以我不必在编辑器中重新加载它们?

我的_bookdown.yml文件是:


new_session: yes

rmd_files: [
 "index.Rmd",

 "encoding.Rmd",
 "includes.Rmd",
 "comments.Rmd",
 "whitespace.Rmd",

 "types.Rmd",
 "expressions.Rmd",
 "statements.Rmd",
 "blocks.Rmd",
 "user-functions.Rmd",

 "execution.Rmd",

 "transforms.Rmd",

 "syntax.Rmd"
]

before_chapter_script: "_common.R"

delete_merged_file: TRUE

我的_common.R


library(ggplot2)
library(rstan)

set.seed(10101010)

options(digits = 3)

printf ",
  collapse = TRUE,
  cache = TRUE,
  out.width = "70%",
  fig.align = 'left',
  fig.width = 6,
  fig.asp = 0.618,  # 1 / phi
  fig.show = "hold"
)

我的index.Rmd文件的开头是:


---
title: "Stan Language Reference"
author: "Stan Development Team"
date: "Version 2.18 (May 2018)"
site: bookdown::bookdown_site
output: bookdown::gitbook
documentclass: book
bibliography: [../bibtex/all.bib]
biblio-style: "apalike"
link-citations: true
fontsize: 11pt
cover-image: img/logo_tm.png
url: 'http\://mc-stan.org/'
github-repo: stan-dev/stan
monofont: "Lucida Console"
description: "Stan reference manual specifying the syntax and semantics of the Stan programming language."
---

1 个答案:

答案 0 :(得分:1)

在Github上 bookdown 0.17.2中的

I just fixed this issue bookdown 的未来版本将不再触摸您的Rmd文件。现在,您可以安装开发版本:

remotes::install_github('rstudio/bookdown')