即使渲染时最简单的rmarkdown文档似乎会创建一个包含javascript的html文档。我期待创建可以成为电子邮件正文的html。有没有一种方法可以在生成的HTML中不使用JavaScript来进行降价?如何在输出中使用不带javascript的RMarkdown呈现HTML
没有什么特别之处下面,它只是一个普通的例子:
---
title: "Sample"
author: "JKGrain"
date: "March 31, 2015"
output: html_document
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r}
summary(cars)
```
You can also embed plots, for example:
```{r, echo=FALSE}
plot(cars)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
生成的HTML源代码是这样开始的:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
<meta name="author" content="JKGrain" />
<meta name="date" content="2015-03-31" />
<title>Sample</title>
<script src="data:application/x-javascript,%2F%2A%21%20jQuery%20v1%2E11.....
显然,我已经修剪的休息HTML,但希望这可以解释这个问题。
@rawr - 我试过了您的建议,并且生成的html仍包含javascript。不管怎么说,还是要谢谢你。 – jkgrain 2015-03-31 14:10:46