【问题标题】:Links not generated correctly in bookdown menu在 bookdown 菜单中未正确生成链接
【发布时间】:2020-09-17 10:02:35
【问题描述】:

如果我在不同的章节中有相同的小节标题(如果每个章节都有一个 Rmd 文件,则会出现问题),然后按照菜单中的链接转到第一小节。

我试图在https://github.com/relund/bookdown-reprex 上做一个小代表。只有当您有多个文件时才会出现该错误。

  1. Extract the zip
  2. 针织指数.Rmd
  3. 在结果输出 (index.html) 中,单击第 3 章下方菜单中的“学习成果”链接,链接到第 2 章中的“学习成果”,而不是应该指向第 3 章的链接
xfun::session_info('bookdown')
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134), RStudio 1.3.959

Locale:
  LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
  LC_NUMERIC=C                           LC_TIME=English_United States.1252    

Package version:
  base64enc_0.1.3 bookdown_0.20   digest_0.6.25   evaluate_0.14   glue_1.4.2      graphics_3.6.3  grDevices_3.6.3 highr_0.8       htmltools_0.5.0
  jsonlite_1.7.1  knitr_1.29      magrittr_1.5    markdown_1.1    methods_3.6.3   mime_0.9        rlang_0.4.7     rmarkdown_2.3   stats_3.6.3    
  stringi_1.4.6   stringr_1.4.0   tinytex_0.25    tools_3.6.3     utils_3.6.3     xfun_0.16       yaml_2.2.1  

【问题讨论】:

  • 这能回答你的问题吗? Broken bookdown heading link with duplicate names
  • 部分。如果您有许多具有相同名称的小节,则该 hack 很有用但很麻烦。此外,正如我指出的那样,如果您在单个文件中指定小节,它实际上是有效的。无论如何,我会一直使用它,直到问题得到解决。

标签: r bookdown


【解决方案1】:

此问题已在 bookdown v0.21(刚刚发布到 CRAN)中得到修复。您可以从 CRAN 更新或重新安装 bookdown

install.packages('bookdown')
# or
update.packages(ask = FALSE, checkBuilt = TRUE)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-09
    • 2014-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多