Skip to content

When character column starts with string suggesting list, and gt::fmt_markdown() enabled, Quarto renders contents twice #1957

@giocomai

Description

@giocomai

Prework

Description

If I pass a data frame with a character column, and that character column starts with strings used for lists in markdown (e.g. "1. " or "-"), and apply gt::fmt_markdown() to the relevant column, then the contents of each row is repeated twice if I render the table in a Quarto html document.

If I just render it with gt, the issue does not appear e.g. in Rstudio's preview pane.

Strictly speaking, the issue may not be in gt itself, but is seemingly the result of the interaction between gt, pandoc, and quarto, so not sure where best to report.

In the real world, this happens when I use gt to report legal documents with lines occasionally starting with numbered provisions, and I rely on fmt_markdown to keep some parts of the text highlighted.

Reproducible example

---
title: "Test gt render with quarto"
format: html
editor: source
---


```{r}
tibble::tibble(a = c("1. a", 
                     "2. b")) |> 
  gt::gt() |> 
  gt::fmt_markdown(columns = "a")
```


```{r}
tibble::tibble(a = c("- a", 
                     "- b")) |> 
  gt::gt() |> 
  gt::fmt_markdown(columns = "a")
```

Expected result

Expected: when I render the html document with Quarto, I'd expect to see it the same as I see it when I preview gt's results, with text appearing once as given.

Actual result: when rendered with Quarto, the content of each row appears repeated twice, similar to this screenshot.

Image

Session info

Quarto version: 1.6.41

Session info

R version 4.4.2 (2024-10-31)
Platform: x86_64-redhat-linux-gnu
Running under: Fedora Linux 41 (Workstation Edition)

Matrix products: default
BLAS/LAPACK: FlexiBLAS OPENBLAS-OPENMP; LAPACK version 3.12.0

locale:
[1] LC_CTYPE=en_IE.UTF-8 LC_NUMERIC=C LC_TIME=en_IE.UTF-8
[4] LC_COLLATE=en_IE.UTF-8 LC_MONETARY=en_IE.UTF-8 LC_MESSAGES=en_IE.UTF-8
[7] LC_PAPER=en_IE.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_IE.UTF-8 LC_IDENTIFICATION=C

time zone: Europe/Vienna
tzcode source: system (glibc)

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_4.4.2 tools_4.4.2 rstudioapi_0.17.1

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions