Bookdown preview_chapter() 不适用于编织按钮
Bookdown preview_chapter() not working with knit button
我目前正在帮助一位教授为他在哈佛的课程 Gov 50 制作一本数据科学书籍。我们在使用 bookdown
包时遇到的问题是我们似乎无法使用 knit
按钮构建单独的章节并在新的 window.[=17 中自动预览章节=]
我们得到的错误是:
Error in files2[[format]] :
attempt to select less than one element in get1index
Calls: <Anonymous> ... render_book -> setdiff -> as.vector -> source_files
Execution halted
因此,我们不得不使用 preview_chapter()
功能,然后手动浏览本书的每个 html 文件以找到我们想要预览的章节。这最终会耗费时间,并使我们的各个章节作者的过程变得困难。有谁知道可能导致问题的原因是什么?
我们的 _output.yml 文件似乎设置正确:
bookdown::tufte_html_book:
df_print: default
css: style.css
split_by: "section"
config:
toc:
collapse: subsection
scroll_highlight: true
看来这个错误是因为指定了Rmd文件的构建顺序造成的。如果我在 _bookdown.yml:
中注释掉这些内容,就可以预览这些章节
rmd_files:
# html: ["index.Rmd", ..., "references.Rmd"]
我目前正在帮助一位教授为他在哈佛的课程 Gov 50 制作一本数据科学书籍。我们在使用 bookdown
包时遇到的问题是我们似乎无法使用 knit
按钮构建单独的章节并在新的 window.[=17 中自动预览章节=]
我们得到的错误是:
Error in files2[[format]] :
attempt to select less than one element in get1index
Calls: <Anonymous> ... render_book -> setdiff -> as.vector -> source_files
Execution halted
因此,我们不得不使用 preview_chapter()
功能,然后手动浏览本书的每个 html 文件以找到我们想要预览的章节。这最终会耗费时间,并使我们的各个章节作者的过程变得困难。有谁知道可能导致问题的原因是什么?
我们的 _output.yml 文件似乎设置正确:
bookdown::tufte_html_book:
df_print: default
css: style.css
split_by: "section"
config:
toc:
collapse: subsection
scroll_highlight: true
看来这个错误是因为指定了Rmd文件的构建顺序造成的。如果我在 _bookdown.yml:
中注释掉这些内容,就可以预览这些章节rmd_files:
# html: ["index.Rmd", ..., "references.Rmd"]