library(gtsummary)
<- gtsummary::tbl_summary(gtsummary::trial, by = trt, include = c(age, grade), missing = "always", label = list(age = "Age \n\U00A0\U00A0linebreak in a cell")) |> add_overall()
tbl <- tbl$table_body |>
gt_table ::gt(caption = gt::md("This is the caption \n[Used for cross referencing in Quarto]")) |>
gt::fmt_markdown(columns = label) |> # need this to recognize the line break in the table body
gt# Column headers with line breaks
::cols_label(
gtstat_0 = gt::md("**Overall**"),
stat_1 = gt::md("**Drug A** \nManual Line Break"),
stat_2 = gt::md("**Drug B** \nManual Line Break")
|>
) ::tab_header(gt::md("This is the Title \nwith a linebreak"), subtitle = "This is the Subtitle")
gt
gt_table
Output Engines Experimentation
Other table output options were experimented with but did not carry forward as the outputs did not render correctly. Below are the results of a few engines tried.