max
max

Reputation: 4521

R Markdown not rendering some HTML?

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

Upvotes: 1

Views: 747

Answers (1)

TarJae
TarJae

Reputation: 78927

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>
```

Upvotes: 3

Related Questions