将* .Rmd文件呈现为html-缺少一些YAML标头条目

时间:2020-10-12 10:00:24

标签: r yaml r-markdown pandoc

我想为我的html输出自定义YAML标头,然后找到"YAML Fieldguide"。这里列出了一些子标题,如:

  • 基本YAML
  • LaTex / PDF选项
  • ...

我不知道如何使用它们-例如电子邮件和关键字。 我的问题是,我没有找到有关如何使用YAML Fieldguide的正确解释。

我想我在这个网站上找到了一些适当的问题,例如 Authors and affiliations in the YAML of RMarkdown 但是对我来说这是行不通的...

在我的研究中,我还发现,您必须根据所需的输出(html,pdf,word ...)来做一个“特殊的” YAML标头。但是在这里我也找不到类似的教程。

所以我的问题是:

  • 在任何地方都有正确的解释说明如何使用YAML字段指南
  • 如何对所需的输出执行调节-html, pdf ...
  • 或对此问题至少有一些提示

非常感谢!

在这里我看到的小代码块没有将电子邮件和关键字呈现为html。

# console input
# rmarkdown::render(input="./yourFile.Rmd",output_file="./yourRenderedFile.html")


---
# The YAML header
title: Customize your YAML header
subtitle: like you want
author: tueftla
email: tueftla@tueftla.com
date: "`r format(Sys.time(), '%d.%m.%Y')`"
output: html_document
abstract: "Content of the abstract"
keywords: word_1, word_2
---

1 个答案:

答案 0 :(得分:1)

如果以此方式编写,作者的电子邮件将显示在开头:

function IsSafari() {


var is_safari = navigator.vendor && navigator.vendor.indexOf('Apple') > -1 &&
               navigator.userAgent &&
               navigator.userAgent.indexOf('CriOS') == -1 &&
               navigator.userAgent.indexOf('FxiOS') == -1;
  return is_safari;

} if(!IsSafari){console.log("No reliable Emoji-set detected. Loading Twemoji from cdnjs");
$.getScript("https://cdnjs.cloudflare.com/ajax/libs/twemoji/12.0.4/2/twemoji.min.js", function() {
   twemoji.parse(document.body);
});}