gt and RMarkdown HTML output: enabling both fig.cap and gt::tab_header


I have a use case where I want both gt's tab_header and RMarkdowns fig.cap to appear. Is there a way to enable both or do I have to workaround, for example with {{captioneer}}

Edit: this question has been solved using caption = "xy" inside gt::gt() (doh..)

Next: How can I place this caption at the bottom of the output/table?


title: "gt caption"
author: ""
date: "10 5 2022"
output: html_document

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

# Header

```{r, fig.cap="I also want this fig.cap", echo = FALSE}
tab <- gt::gt(pressure, caption = "xy")

tab <- gt::tab_header(tab,
    title = gt::md(
      "Title via tab_header"))

See this FAQ: How to Format R Markdown Source to format correctly your example.