Title not showing in R Markdown with knitr when rendering markdown file

I'm trying to convert a .Rmd file to .md (output: md_document), but the title is not showing in the render.

The header appears when I try to display the same file as the .html file (output: html_document).

The title is displayed on the rendered document:

---
title: "Test"
output: html_document
---

```{r}

head(cars)
```

      


The title is not displayed on the rendered document:

---
title: "Test"
output: md_document
---

```{r}

head(cars)
```

      


rmarkdown::render(my_file)

      

Any ideas why?

I am using RStudio 0.98.1091 and R 3.1.2 on Mac 10.9.5.


The code in between is --

interpreted as my links are displayed with the following piece of code:

---
title: "Test"
output: md_document
bibliography: ~/mybib.bib
---

This is a test where I cite [@post1, @post2]

      


Interestingly, when I ask to create html and md files, the title appears in the .md file:

---
title: "Test"
output:
  html_document:
    keep_md: yes
---

      

Shouldn't the conclusion keep_md: yes

be the same as output: md_document

?

+3


source to share


1 answer


Markdown has no such thing as "title". HTML has a tag <title>

(and Pandoc also puts a header in <h1>

for HTML output from Markdown so you can see it from the HTML body), and LaTeX has a command \title{}

. I'm not surprised that YAML metadata (including title information) isn't reflected in the Markdown output.



+4


source







All Articles