---
title: "R Markdown loop with flextable for HTML"
output: html_document
---

```{r setup, include=FALSE}
library(flextable)
library(htmltools)
library(knitr)

opts_chunk$set(echo = TRUE)

ft_list <- list()

ft1 <- qflextable( head( airquality ))
ft1 <- set_caption(ft1,"airquality table")
ft_list[[1]] <- ft1

ft2 <- qflextable( tail( mtcars ))
ft2 <- set_caption(ft2,"mtcars table")
ft_list[[2]] <- ft2
```

```{r echo = FALSE}
div(flextable_html_dependency())
```

```{r results='asis', echo = FALSE}
for(i in seq_along(ft_list)){
  flextable_to_rmd(ft_list[[i]])
}
```

