Not sure if this is an issue with quarto, the R package gt, pandoc, or something else.

If an R gt table uses the tab_header function, the table will no longer render to docx, although it will render to html and pdf.

The self-contained qmd example below creates a gt table without tab_header, and then one with tab_header. The first table will render to all three formats but the second renders only to html and pdf, but not to docx. Not shown - the table will render to docx if title=NULL, but then it won't have a title, of course. If I alter the second example below to wrap the title in md or html (i.e., title=md("abc") or title=html("abc")) it still will not render to docx.

I also have done this with dev versions of quarto-cli and RStudio but have the same problem.

I don't have great workarounds. I can gtsave the table to a png file and then include it as a picture, or use NULL titles.

Advice welcome on what I can do to work around, and whether I should report this elsewhere.

Many thanks.

**Minimal reproducible example below (a qmd file).**

````
--- 
format:
  html:
    theme: cosmo
  pdf:
    documentclass: scrreprt
  docx:
    toc: true
---

Show how tab_header affects quarto rendering to docx

Setup:

Windows 11 Pro Build 22623
R-4.2.1
RStudio-2022.07.2-576.exe
quarto-1.1.251-win.msi


```{r}
library(tidyverse)
library(gt)

```


Table without header

```{r}
mtcars |> 
  gt()
```


Table with header

```{r}
mtcars |> 
  gt() |> 
  tab_header(title="abc")
```
````


2022-10-18T19:02:40Z
donboyd5
third-party tables
closed
Possible bug: R gt tables do not render to docx when tab_header is used with anything other than NULL titles
https://github.com/quarto-dev/quarto-cli/issues/2916