简体   繁体   English

在Rstudio和knit2html命令行中使用knitr之间的HTML输出是不同的

[英]HTML outputs are different between using knitr in Rstudio & knit2html in command line

I am trying to generate html documents from R markdown files using knitr. 我正在尝试使用knitr从R markdown文件生成html文档。

When I use the knit html button in R studio it works fine and it gets me the desired output. 当我在R studio中使用knit html按钮时它工作正常,它可以获得所需的输出。

However when I use knit2html() in the commandline, the formatting of the output html is different (less prettier) than that obtained from rstudio. 但是当我在命令行中使用knit2html()时,输出html的格式与rstudio的格式不同(不那么漂亮)。

Can you tell me what are the exact options and functions that are being used when I press the knit html button? 你能告诉我按下knit html按钮时使用的确切选项和功能是什么吗?

I wanted to include images, but apparently my "reputation" is too low... 我想要包含图片,但显然我的“声誉”太低了......

Basically, the major difference are : 基本上,主要区别是:

1) code chunks and outputs have smoother edges 1)代码块和输出具有更平滑的边缘

2) header is included. 2)包含标题。

3) Font sizes 3)字体大小

Now RStudio uses R Markdown v2 by default, and knitr::knit2html() still uses R Markdown v1 . 现在RStudio默认使用R Markdown v2 ,而knitr::knit2html()仍然使用R Markdown v1 V2 uses Pandoc and Twitter Bootstrap themes, which are prettier than the style in v1. V2使用Pandoc和Twitter Bootstrap主题,这些主题比v1中的样式更漂亮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM