R Markdown Add tag for heading HTML output

I am trying to add an HTML meta tag in the header of the output HTML RMarkdown file from RStudio. Specifically, I am trying to add the following IE compatibility issues to our intranet.

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
</head>

      

Any help on how best to accomplish this would be greatly appreciated.

+3


source to share


1 answer


You can create a file with a meta tag and add with the following YAML option:

---
title: "mytitle"
output:
  html_document:
    includes:
       in_header: myheader.html
---

      



You can also create a file myheader.html

on the fly in your chanck setup:

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE )
#libraries
require(ggplot2)

#Create myheader.html
fileConn <- file("myheader.html")
writeLines('<meta http-equiv="X-UA-Compatible" content="IE=edge" />', fileConn)
close(fileConn)
```

      

+3


source







All Articles