Skip to content

Get tab_spanner_delim to retain md formatting or document that it drops it #1130

@LukasWallrich

Description

@LukasWallrich

Description

When column labels are formatted with md(), e.g., in cols_label(), that formatting gets silently dropped when you call tab_spanner_delim(). Ideally, I think that tab_spanner_delim() should retain the format - otherwise, this behaviour should be documented (and possibly even a warning issued, given that the user is unlikely to want to drop formatting that was explicitly assigned)?

Reproducible example

library(gt)
iris[1:5,] %>%
  gt() %>% 
  cols_label(Sepal.Width = md("Sepal.*W*idth")) %>% 
  tab_spanner_delim(".")

Expected result

The italics on the W should have been kept.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions