wilkelab / ggtext

Improved text rendering support for ggplot2
https://wilkelab.org/ggtext/
GNU General Public License v2.0
650 stars 37 forks source link

html inside `labs(title = "xyz")` doesn't render #77

Closed jsavinc closed 2 years ago

jsavinc commented 2 years ago

Hi, I can't get the below minimal example to render properly with ggtext version 0.1.1 - instead, the text is shown literally (including the html tags).

library(ggplot)
library(ggtext)

ggplot(mtcars) +
  geom_point(aes(x = wt, y = cyl)) +
  labs(
    title = "<span style='color:#0072B2;'>Title of a different colour</span>"
  )

I've pasted my sessionInfo() output also:

R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] lemon_0.4.5             openxlsx_4.2.5          extrafont_0.17          patchwork_1.1.1         ggrepel_0.9.1           sf_1.0-5                ISOweek_0.6-2          
 [8] janitor_2.1.0           lubridate_1.8.0         readxl_1.3.1            phsmethods_0.2.0        opendatascot_0.0.0.9000 forcats_0.5.1           stringr_1.4.0          
[15] dplyr_1.0.7             purrr_0.3.4             readr_2.1.1             tidyr_1.1.4             tibble_3.1.6            ggplot2_3.3.5           tidyverse_1.3.1        

loaded via a namespace (and not attached):
 [1] httr_1.4.2         viridisLite_0.4.0  jsonlite_1.7.2     modelr_0.1.8       assertthat_0.2.1   cellranger_1.1.0   yaml_2.2.1         Rttf2pt1_1.3.9    
 [9] pillar_1.6.4       backports_1.4.1    lattice_0.20-44    glue_1.6.0         extrafontdb_1.0    digest_0.6.27      rvest_1.0.2        snakecase_0.11.0  
[17] colorspace_2.0-2   plyr_1.8.6         htmltools_0.5.1.1  pkgconfig_2.0.3    broom_0.7.11       haven_2.4.3        scales_1.1.1       tzdb_0.2.0        
[25] proxy_0.4-26       farver_2.1.0       generics_0.1.1     ellipsis_0.3.2     withr_2.4.3        cli_3.1.0          magrittr_2.0.1     crayon_1.4.2      
[33] evaluate_0.14      fs_1.5.2           fansi_0.5.0        xml2_1.3.3         class_7.3-19       tools_4.1.0        hms_1.1.1          lifecycle_1.0.1   
[41] munsell_0.5.0      reprex_2.0.1       zip_2.2.0          compiler_4.1.0     e1071_1.7-9        rlang_0.4.11       classInt_0.4-3     units_0.7-2       
[49] grid_4.1.0         rstudioapi_0.13    labeling_0.4.2     rmarkdown_2.11     gtable_0.3.0       DBI_1.1.2          R6_2.5.1           gridExtra_2.3     
[57] knitr_1.37         utf8_1.2.2         KernSmooth_2.23-20 stringi_1.7.6      Rcpp_1.0.7         vctrs_0.3.8        dbplyr_2.1.1       tidyselect_1.1.1  
[65] xfun_0.23    
clauswilke commented 2 years ago

Please read the documentation.