为什么{.tabset}无法与htmltools :: tagList一起使用?

时间:2019-07-11 12:27:56

标签: r r-markdown

该内容看起来不错,除了有“常规”部分没有选项卡。我也尝试过:

  • 使用cat(paste0("### Number ", i, "{.tabset}\n"))代替htmltools::h3(...)
  • tabset = TRUE中寻找可能的参数htmltools::h3

最小的可复制示例:

---
title: "Test"
author: "SQC"
date: "11 Juli 2019"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(leaflet)
ranges <- paste0("section_", c(1:3))
```

# Title level 1

```{r, echo=FALSE, results='hide'}
html <- list()
for (i in 2:3) {
  html <- c(html, 
            list(htmltools::h3(paste0("Number ", i, "\n")),
                 leaflet() %>%
                   addTiles() %>%
                   addProviderTiles(providers$OpenStreetMap, group = "OSM") %>%
                   addProviderTiles(providers$Stamen.TonerLite, group = "Toner Lite") %>%
                   addLayersControl(baseGroups = c("OSM", "Toner Lite")) %>%
                   addCircleMarkers(lat = 47, lng = 9, popup = ranges[i])))
}
```

## Title level 2 with tabset {.tabset}

```{r echo=FALSE}
htmltools::tagList(html)
```

0 个答案:

没有答案