Side-by-side htmlwidgets with figure captions

Hello! I am running into trouble displaying side-by-side htmlwidgets (e.g. leaflet maps, ggiraph plots, highcharter) in quarto, but only when trying to include a caption for each figure. I leave below an example using leaflet, with my session info in case it helps.

Thanks in advance for any help :slightly_smiling_face:

Session info
- Session info ---------------------------------------------------------------
 setting  value                       
 version  R version 4.1.0 (2021-05-18)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RTerm                       
 language (EN)                        
 collate  French_France.1252          
 ctype    French_France.1252          
 tz       Europe/Paris                
 date     2022-08-09                  

- Packages -------------------------------------------------------------------
 package     * version date       lib source        
 cli           3.0.0   2021-06-30 [1] CRAN (R 4.1.0)
 crosstalk     1.1.1   2021-01-12 [1] CRAN (R 4.1.0)
 digest        0.6.27  2020-10-24 [1] CRAN (R 4.1.0)
 evaluate      0.15    2022-02-18 [1] CRAN (R 4.1.3)
 htmltools     0.5.1.1 2021-01-22 [1] CRAN (R 4.1.0)
 htmlwidgets   1.5.3   2020-12-10 [1] CRAN (R 4.1.0)
 jsonlite      1.8.0   2022-02-22 [1] CRAN (R 4.1.3)
 knitr         1.39    2022-04-26 [1] CRAN (R 4.1.3)
 leaflet     * 2.0.4.1 2021-01-07 [1] CRAN (R 4.1.0)
 magrittr      2.0.1   2020-11-17 [1] CRAN (R 4.1.0)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.1.3)
 rlang         1.0.2   2022-03-04 [1] CRAN (R 4.1.3)
 rmarkdown     2.14    2022-04-25 [1] CRAN (R 4.1.0)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.1.0)
 stringi       1.6.2   2021-05-17 [1] CRAN (R 4.1.0)
 stringr       1.4.0   2019-02-10 [1] CRAN (R 4.1.0)
 withr         2.4.2   2021-04-18 [1] CRAN (R 4.1.0)
 xfun          0.31    2022-05-10 [1] CRAN (R 4.1.3)
 yaml          2.2.1   2020-02-01 [1] CRAN (R 4.1.0)

[1] C:/R/win-library/4.1
[2] C:/R/R-4.1.0/library
---
title: "Side-by-side widgets with figure captions"
format: html
editor: source
---

```{r}
library(leaflet)
map <- leaflet() %>%
  addTiles() %>%  # Add default OpenStreetMap map tiles
  addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R")
```

One HTML widget, with figure caption

```{r}
#| fig-cap: "No problem with this caption"
map
```

Two HTML widgets, without figure caption

```{r}
#| layout-ncol: 2
map
map
```

Two HTML widgets, with two figure captions

```{r}
#| layout-ncol: 2
#| fig-cap: 
#|   - First caption
#|   - Second caption
map
map
```
````

Seems like a bug to me.

You're right. It's related to this issue. I commented on it and will cross-link to this question.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.