Prework
Proposal
I really love the feature to add a named list of column labels to cols_label(). In most cases this list evolves during my data processing work prior to the table creation. I would like to use md() here to add a line break to my column labels. The below code works fine:
library(gt)
library(tidyverse)
col_list1 <- list(
"mfr" = "Manufacturer",
"model" = "Model",
"hp_rpm" = md("Horse Power \n(rpm)")
)
gt::gtcars |>
dplyr::filter(mfr == "BMW") |>
dplyr::select(mfr, model, hp_rpm) |>
gt() |>
cols_label(
.list = col_list1
)

However, these ones don't:
library(gt)
library(tidyverse)
col_list2 <- as.list(c("Manufacturer", "Model", md("Horse Power \n(rpm)"))) |>
purrr::set_names(c("mfr", "model", "hp_rpm"))
gt::gtcars |>
dplyr::filter(mfr == "BMW") |>
dplyr::select(mfr, model, hp_rpm) |>
gt() |>
cols_label(
.list = col_list2
)
col_list3 <- as.list(c("Manufacturer", "Model", "Horse Power \n(rpm)")) |>
purrr::set_names(c("mfr", "model", "hp_rpm"))
gt::gtcars |>
dplyr::filter(mfr == "BMW") |>
dplyr::select(mfr, model, hp_rpm) |>
gt() |>
cols_label(
.list = md(col_list3)
)

Thanks so much in advance!
Prework
Proposal
I really love the feature to add a named list of column labels to
cols_label(). In most cases this list evolves during my data processing work prior to the table creation. I would like to usemd()here to add a line break to my column labels. The below code works fine:However, these ones don't:
Thanks so much in advance!