Problem with sjPlot::tab_model() and tabsets in rmarkdown document, all tabs get aggregated within the first tabset

I have problems adding tabsets after using sjPlot::tab_model() within a rmarkdown file, the tabs of the new tabset just get aggregated with the previous tabset.

I suppose the html code generated by tab_model() interferes with the html code generated by {.tabset} but i cant figure how to avoid it. Could anybody help me with this?

Here is a reproducible example

---
title: "R Notebook"
output: html_notebook
---

```{r setup, include=FALSE}
library(sjPlot)
library(magrittr)
library(knitr)
```

## Tab Set 1 {.tabset}

### Tab 1
```{r}
lm(speed~dist, data = cars) %>%
    tab_model() %>% 
    return() %$% 
    knitr %>% 
    asis_output()
```

## Tab Set 2 {.tabset}

### Tab 1
```{r}
plot(cars)
```

And this is the desired output without using tab_model().

This issue was solved by strengejacke in the last development version of sjPlot (you also need to install the development version of sjStats from GitHub).

2 Likes