如何将我的YAML标题放在R markdown html文档中?

the*_*ist 3 html yaml r r-markdown shiny

我希望我的YAML标题信息以我的html文档为中心.

我希望其他所有内容都保持正常状态.

我可以将任何html或其他代码应用于YAML标头以实现此目的吗?

我该怎么做呢??

例:

我有:

---
title: "Shiny HTML Doc"
author: "theforestecologist"
date: "Apr 14, 2017"
output:  html_document
runtime: shiny
---
Run Code Online (Sandbox Code Playgroud)

Mik*_*ise 11

这里有一些css样式,你可以用来完成你需要的东西.

  • 降价文档标题使用h1.titleCSS选择器
  • 降价文档作者字段使用h4.authorCSS选择器
  • 降价文档datea字段使用h4.dateCSS选择器

这是代码:

---
title: "Shiny HTML Doc"
author: "theforestecologist"
date: "Apr 14, 2017"
output:  html_document
runtime: shiny
---

<style type="text/css">

h1.title {
  font-size: 38px;
  color: DarkRed;
  text-align: center;
}
h4.author { /* Header 4 - and the author and data headers use this too  */
    font-size: 18px;
  font-family: "Times New Roman", Times, serif;
  color: DarkRed;
  text-align: center;
}
h4.date { /* Header 4 - and the author and data headers use this too  */
  font-size: 18px;
  font-family: "Times New Roman", Times, serif;
  color: DarkBlue;
  text-align: center;
}
</style>


# H1 Header

Some body text

## H2 Header

More body text



```{r echo=T}
n <- 100
df <- data.frame(x=rnorm(n),y=rnorm(n))
```
Run Code Online (Sandbox Code Playgroud)

这就是它最终的样子:

在此输入图像描述