问题描述
我正在使用rmarkdown和 revealjs模板在RStudio中进行演示.由于这项工作仍在进行中,因此我经常编织.Rmd文件以查看更改.
I'm working on a presentation in RStudio using rmarkdown and revealjs template. Since it's a work in progress, I often knit the .Rmd file to see the changes.
问题是,每次我按编织"按钮(或使用热键)时,都会弹出一个内部浏览器窗口.我真的不需要它,因为1)它不正确地显示演示文稿,并且2)我已经在系统浏览器中打开了.html文件,而我只是刷新页面.
The problem is, each time I press "Knit" button (or use a hotkey), an internal browser window pops up. I don't need it, really, because 1) it displays the presentation incorrectly and 2) I already have the .html file open in my system browser and I simply refresh the page.
有什么方法可以抑制默认的RStudio行为?
Is there any way to suppress the default RStudio behaviour?
理想情况下,我希望能够在尽可能少的按键操作下进行编织并在系统浏览器(着重于此)中查看结果.现在,我的解决方法是source(render.R)
,其中包含
Ideally, I'd love to be able to knit and see the result in the system browser (with focus on it) in as few keypresses as possible. Right now, my solution is to source(render.R)
, which contains a call like
library(rmarkdown)
library(revealjs)
render("main.Rmd",
revealjs_presentation(theme="black", highlight="zenburn"),
encoding = "UTF-8")
总比没有好,但仍然有些繁琐(将焦点从编辑设置为控制台,源代码,刷新页面-3个动作).有什么建议吗?
Better than nothing, but still a bit tedious (set focus from editing to console, source, refresh page -- 3 actions). Any suggestions?
对于MWE,打开[新文件]-[R Markdown ...],然后单击编织HTML"或Ctrl + Shift + K.
For an MWE, open [New File] -- [R Markdown...] and hit "Knit HTML" or Ctrl+Shift+K.
推荐答案
RStudio一直在移动此功能. Johnathan的答案对我使用的RStudio的早期版本很有用.您可以从工具>全局选项开始,然后如果您使用的是0.99.x,则可以找到它:
RStudio keeps moving this feature around. Johnathan's answer was good for the prior version of RStudio that I was using. You could find it starting with Tools > Global Options and then if you are on 0.99.x, here:
我目前在1.0.44,现在在这里:
I'm currently on 1.0.44 and now it's here:
为了公平起见,对于RStudio而言,我认为创建一个新的 R Markdown 选项部分并将其放在此处是很有意义的.
In all fairness to RStudio, I think creating a new R Markdown option section and putting it here makes good sense.
这篇关于编织后请勿打开RStudio内部浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!