1

When I knit an R Markdown file with the following code, not all of the HTML is rendered. Any thoughts on what is happening here?

R Markdown file

---
title: "html test"
author: "NA"
date: "1/16/2021"
output: html_document
---

<div class="grid-container">
    <div class="grid-item grid-item1"> col1 </div>
    <div class="grid-item grid-item2"> col2 </div>
    <div class="grid-item grid-item3"> col3 </div>
</div>

Output

R Markdown output

However, when I put the same code into a HTML file and open it in a web browser, it renders just fine.

Using an HTML file

max
  • 4,141
  • 5
  • 26
  • 55

1 Answers1

3

This should work, see: https://bookdown.org/yihui/rmarkdown-cookbook/raw-content.html:

---
title: "html test"
author: "NA"
date: "1/16/2021"
output: html_document
---

```{=html}
<div class="grid-container">
    <div class="grid-item grid-item1"> col1 </div>
    <div class="grid-item grid-item2"> col2 </div>
    <div class="grid-item grid-item3"> col3 </div>
</div>
```
Yihui Xie
  • 28,913
  • 23
  • 193
  • 419
TarJae
  • 72,363
  • 6
  • 19
  • 66