Repository navigation
Word output with gt::md() in column labels #1067
Copy link
Copy link
Closed
Milestone
Description
Description
Using gt::md() with bold syntax in the header does not render properly
Reproducible example
---
title: "gt: checks"
output: word_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
```{r, message = FALSE}
mtcars[1:5, 1:5] |>
gt::gt() |>
gt::cols_label(mpg = gt::md("**MPG**"))Expected result
A bolded MPG column label
Session info
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.2.1 (2022-06-23 ucrt)
#> os Windows 10 x64 (build 19042)
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United States.utf8
#> ctype English_United States.utf8
#> tz America/New_York
#> date 2022-09-24
#> pandoc 2.18 @ C:/Program Files/RStudio/bin/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> assertthat 0.2.1 2019-03-21 [2] CRAN (R 4.2.0)
#> cli 3.4.0 2022-09-08 [2] CRAN (R 4.2.1)
#> colorspace 2.0-3 2022-02-21 [2] CRAN (R 4.2.0)
#> commonmark 1.8.0 2022-03-09 [2] CRAN (R 4.2.0)
#> DBI 1.1.3 2022-06-18 [2] RSPM (R 4.2.0)
#> digest 0.6.29 2021-12-01 [2] CRAN (R 4.2.0)
#> dplyr 1.0.10 2022-09-01 [2] CRAN (R 4.2.1)
#> evaluate 0.16 2022-08-09 [2] RSPM (R 4.2.0)
#> fansi 1.0.3 2022-03-24 [2] CRAN (R 4.2.0)
#> fastmap 1.1.0 2021-01-25 [2] CRAN (R 4.2.0)
#> fs 1.5.2 2021-12-08 [2] CRAN (R 4.2.0)
#> generics 0.1.3 2022-07-05 [2] RSPM (R 4.2.0)
#> ggplot2 3.3.6 2022-05-03 [2] CRAN (R 4.2.0)
#> glue 1.6.2 2022-02-24 [2] CRAN (R 4.2.0)
#> gt 0.7.0.9000 2022-09-20 [1] local
#> gtable 0.3.1 2022-09-01 [2] CRAN (R 4.2.1)
#> highr 0.9 2021-04-16 [2] CRAN (R 4.2.0)
#> htmltools 0.5.3 2022-07-18 [1] CRAN (R 4.2.1)
#> knitr 1.40 2022-08-24 [2] CRAN (R 4.2.1)
#> lifecycle 1.0.2 2022-09-09 [2] CRAN (R 4.2.1)
#> magrittr 2.0.3 2022-03-30 [2] CRAN (R 4.2.0)
#> munsell 0.5.0 2018-06-12 [2] CRAN (R 4.2.0)
#> pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.1)
#> pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 4.2.0)
#> purrr 0.3.4 2020-04-17 [2] CRAN (R 4.2.0)
#> R.cache 0.16.0 2022-07-21 [2] RSPM (R 4.2.0)
#> R.methodsS3 1.8.2 2022-06-13 [2] CRAN (R 4.2.0)
#> R.oo 1.25.0 2022-06-12 [2] CRAN (R 4.2.0)
#> R.utils 2.12.0 2022-06-28 [2] RSPM (R 4.2.0)
#> R6 2.5.1 2021-08-19 [2] CRAN (R 4.2.0)
#> reprex 2.0.2 2022-08-17 [1] RSPM (R 4.2.0)
#> rlang 1.0.5 2022-08-31 [1] CRAN (R 4.2.1)
#> rmarkdown 2.16 2022-08-24 [1] CRAN (R 4.2.1)
#> rstudioapi 0.14 2022-08-22 [2] CRAN (R 4.2.1)
#> sass 0.4.2 2022-07-16 [1] CRAN (R 4.2.1)
#> scales 1.2.1 2022-08-20 [2] CRAN (R 4.2.1)
#> sessioninfo 1.2.2 2021-12-06 [2] CRAN (R 4.2.0)
#> stringi 1.7.8 2022-07-11 [1] CRAN (R 4.2.1)
#> stringr 1.4.1 2022-08-20 [2] CRAN (R 4.2.1)
#> styler 1.7.0 2022-03-13 [2] CRAN (R 4.2.0)
#> tibble 3.1.8 2022-07-22 [2] RSPM (R 4.2.0)
#> tidyselect 1.1.2.9000 2022-09-18 [1] Github (r-lib/tidyselect@851ae9c)
#> utf8 1.2.2 2021-07-24 [2] CRAN (R 4.2.0)
#> vctrs 0.4.1 2022-04-13 [2] CRAN (R 4.2.0)
#> withr 2.5.0 2022-03-03 [2] CRAN (R 4.2.0)
#> xfun 0.33 2022-09-12 [2] CRAN (R 4.2.1)
#> yaml 2.3.5 2022-02-21 [2] CRAN (R 4.2.0)
#>
#> [1] C:/Users/SjobergD/R-dev
#> [2] C:/Program Files/R/R-4.2.1/library
#>
#> ──────────────────────────────────────────────────────────────────────────────Thank you for the best pkg ever! 🍁
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone

Activity
[-]Word output with `gt::md()` in title[/-][+]Word output with `gt::md()` in column labels[/+]rich-iannone commentedon Oct 12, 2022
Thanks for discovering this and creating the issue! This one’s pretty important to fix.
ddsjoberg commentedon Oct 27, 2022
Just a bit more detail: this also applies to the spanning headers. Thank you! 🍁
thebioengineer commentedon Nov 4, 2022
Yeah, right now there isn't much support for markdown inline. I didn't investigate what was existing. It is on the list of things!
ddsjoberg commentedon Nov 4, 2022
@thebioengineer if i can help in some way, please do let me know! thank you!
thebioengineer commentedon Nov 4, 2022
I'm working through it, honestly your examples are super helpful. Testing word is not easy (@rich-iannone and I spent probably too many hours trying to think of ways) other than just opening up the word doc to see if it rendered properly
rich-iannone commentedon Mar 27, 2023
Works great now!
MikeJohnPage commentedon Sep 26, 2024
Using
gt::md()renders different markdown syntax differently, depending upon where it is called.Reprex:
Note:
Versions:
rich-iannone commentedon Sep 26, 2024
@MikeJohnPage Thanks for bringing this up. I've made a new issue, #1892, to track this (comments in old, closed issues tend to get lost in the shuffle).
MikeJohnPage commentedon Sep 26, 2024
Thanks @rich-iannone, I appreciate you taking a look at this.