我最近买了一台带有Windows 11的新笔记本电脑(尽管我的sessionInfo()声明了Windows 10),我正试图为我正在开发的一个R包构建一个pkgdown站点。这不是我过去遇到的问题。运行命令pkgdown::build_site()不能正确地将我的自定义徽标链接到这个R包的HTML。
自定义徽标png,用于后代:brConnectR徽标
man/figures/logo.png文件是用usethis::use_logo("path/to/logo.png")生成的,而偏爱图标是作为pkgdown::build_site()过程的一部分生成的,但是,生成的docs/index.html无法捕获任何徽标。下面是我的sessionInfo()
> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] brConnectR_0.0.0.9000 usethis_2.1.3
loaded via a namespace (and not attached):
[1] tidyselect_1.1.1 xfun_0.27 remotes_2.4.1 purrr_0.3.4
[5] rcmdcheck_1.4.0 vctrs_0.3.8 generics_0.1.1 testthat_3.1.0
[9] htmltools_0.5.2 yaml_2.2.1 utf8_1.2.2 blob_1.2.2
[13] rlang_0.4.12 pkgbuild_1.2.0 pkgdown_1.6.1 pillar_1.6.4
[17] glue_1.4.2 withr_2.4.2 DBI_1.1.1 bit64_4.0.5
[21] xopen_1.0.0 dbplyr_2.1.1 sessioninfo_1.1.1 lifecycle_1.0.1
[25] stringr_1.4.0 commonmark_1.7 devtools_2.4.2 memoise_2.0.0
[29] evaluate_0.14 knitr_1.36 callr_3.7.0 fastmap_1.1.0
[33] ps_1.6.0 curl_4.3.2 fansi_0.5.0 Rcpp_1.0.7
[37] clipr_0.7.1 cachem_1.0.6 desc_1.4.0 pkgload_1.2.3
[41] magick_2.7.3 fs_1.5.0 bit_4.0.4 hms_1.1.1
[45] digest_0.6.28 stringi_1.7.5 processx_3.5.2 dplyr_1.0.7
[49] rprojroot_2.0.2 cli_3.0.1 tools_4.1.1 odbc_1.3.2
[53] magrittr_2.0.1 tibble_3.1.5 crayon_1.4.1 pkgconfig_2.0.3
[57] ellipsis_0.3.2 xml2_1.3.2 prettyunits_1.1.1 assertthat_0.2.1
[61] rmarkdown_2.11 roxygen2_7.1.2 rstudioapi_0.13 R6_2.5.1
[65] compiler_4.1.1任何指点都将不胜感激!
发布于 2021-10-29 22:06:01
我在pkgdown::build_home() 参考页的Package部分解决了这个问题。
如果您有一个包徽标,您可以将它包含在您的自述文件的顶部的第一级标题中:
# pkgdown <img src="man/figures/logo.png" align="right" />init_site()还将自动从您的包徽标中创建一个偏爱图标。
除了上面的内容之外,我还安装了pkgdown的开发版本,这修复了我在运行pkgdown::build_site()时得到的一个神秘的警告(“警告被弃用: markdown_github.使用gfm")。
从GitHub:devtools::install_github("r-lib/pkgdown")安装dev版本
https://stackoverflow.com/questions/69774796
复制相似问题