Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML id tags of gt table clash with id tags of .tabset RMarkdown headers #1586

Open
6 tasks done
hhhh5 opened this issue Feb 24, 2024 · 0 comments
Open
6 tasks done
Assignees

Comments

@hhhh5
Copy link

hhhh5 commented Feb 24, 2024

Prework

Description

The id attributes of the <th> table cells can clash with the automatically generated id attributes of markdown headers. This becomes a problem when used together with {.tabset} as one can no longer switch between tabs. Only the first tab is visible.

In the example below, when you click to see the second tab "premium", the content associated with it ("bar") does not become visible.

Reproducible example

---
title: "MWE"
output: html_document
date: '2024-02-24'
---

```{r}
library(tidyr)
library(gt)
library(magrittr)


ggplot2::diamonds %>%
  dplyr::mutate(across(cut, tolower)) %>%
  tidyr::pivot_wider(id_cols = color, names_from = cut, values_from = price, values_fn = mean) %>%
  gt::gt()
```

# cut {.tabset}

## ideal {.unnumbered}

```{r}
cat("foo")
```

## premium

```{r}
cat("bar")
```
  • Post a minimal reproducible example so the maintainer can troubleshoot the problems you identify. A reproducible example is:
    • Runnable: post enough R code and data so any onlooker can create the error on their own computer.
    • Minimal: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand.
    • Readable: format your code according to the tidyverse style guide.

Expected result

Maybe a prefix can be added to the id attributes to avoid name clashes.

Session info

This was tested for gt version 0.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants