mitchelloharawild / vitae

R Markdown Résumés and CVs
https://pkg.mitchelloharawild.com/vitae/
1.21k stars 234 forks source link

Commit f32ca0b causes markdowncv themes to break? #261

Open monicathieu opened 1 month ago

monicathieu commented 1 month ago

I updated vitae to 0.6.0 because I was excited to try Colton Baumler's new ccbaumler theme for the markdowncv format. However, my previously rendering CV (using the davewhipp theme) suddenly started to render to a "plain" R Markdown and the theming fails to apply! I haven't changed anything on my CV Rmd.

Also, the following pandoc warnings are now showing up on the Render tab:

[WARNING] Could not fetch resource media/../fonts/academicons.ttf
[WARNING] Could not fetch resource media/davewhippbootstrap-screen.css
[WARNING] Could not fetch resource media/davewhippbootstrap-print.css

This suggests pandoc is failing to find the theme CSS paths, but I sadly don't don't know enough about how vitae calls knitr and pandoc under the hood to know what exactly the issue is.

I have narrowed it down to something in commit f32ca0b, which definitely suggests it's a knitr-to-pandoc issue of some sort. The theme appears correctly when I reinstall vitae on the previous commit (no changes to the Rmd file or anything else).

Annoyingly, the previous commit has that duplication issue the offending commit fixes. I saw some comments in #254 suggesting the duplication was arising from a knitr update, but I checked through several package versions and I actually think it came from the xfun 0.44 update--maybe because xfun::write_utf8() now returns con, not NULL? I did confirm that the theme-less CV knitted after commit f32ca0b does not duplicate the CV contents.

Relevant version info:

R 4.3.1 pandoc 3.1.11 knitr 1.47 (but this issue also happens with 1.43) rmarkdown 2.25

mitchelloharawild commented 1 month ago

Thanks for the thorough investigation @monicathieu! I'll look into f32ca0b01d6e3e93e0f21152268dd10a28c153ed again, especially with how we might be using xfun::write_utf8().

LizHareDogs commented 2 weeks ago

Hi! Thank you @mitchelloharawild for this super helpful package and @monicathieu for tracking down the error.

I get the same warnings with this setup in Emacs with ESS:

> sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: x86_64-apple-darwin20
Running under: macOS Ventura 13.6.6

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

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

other attached packages:
[1] dplyr_1.1.4    tibble_3.2.1   vitae_0.6.0    rmarkdown_2.27 knitr_1.48    
[6] devtools_2.4.5 usethis_3.0.0 

loaded via a namespace (and not attached):
 [1] sass_0.4.9        utf8_1.2.4        generics_0.1.3    stringi_1.8.4    
 [5] digest_0.6.36     magrittr_2.0.3    evaluate_0.24.0   pkgload_1.4.0    
 [9] fastmap_1.2.0     jsonlite_1.8.8    pkgbuild_1.4.4    sessioninfo_1.2.2
[13] urlchecker_1.0.1  promises_1.3.0    purrr_1.0.2       fansi_1.0.6      
[17] jquerylib_0.1.4   cli_3.6.3         shiny_1.9.1       rlang_1.1.4      
[21] ellipsis_0.3.2    withr_3.0.1       remotes_2.5.0     cachem_1.1.0     
[25] yaml_2.3.10       tools_4.4.0       memoise_2.0.1     httpuv_1.6.15    
[29] vctrs_0.6.5       R6_2.5.1          mime_0.12         lifecycle_1.0.4  
[33] stringr_1.5.1     fs_1.6.4          htmlwidgets_1.6.4 miniUI_0.1.1.1   
[37] pkgconfig_2.0.3   pillar_1.9.0      bslib_0.7.0       later_1.3.2      
[41] glue_1.7.0        profvis_0.3.8     Rcpp_1.0.13       xfun_0.46        
[45] tidyselect_1.2.1  xtable_1.8-4      htmltools_0.5.8.1 compiler_4.4.0   

Please let me know if there's anything I can do to help fix this. I'm not sure why the files for the fonts, etc. aren't located in the expected locations.