rstudio / bookdown

Authoring Books and Technical Documents with R Markdown
https://pkgs.rstudio.com/bookdown/
GNU General Public License v3.0
3.78k stars 1.27k forks source link

Bookdown incorrectly links to functions for generics and there's no way to change defaults #1406

Open Robinlovelace opened 1 year ago

Robinlovelace commented 1 year ago

In the open source book Geocompuation with R, the following input

`sf` objects can be plotted quickly with the base R function `plot()`;

is converted into this HTML output:

<code>sf</code> objects can be plotted quickly with the base R function <code><a href="[https://rdrr.io/pkg/terra/man/plot.html](view-source:https://rdrr.io/pkg/terra/man/plot.html)">plot()</a></code>;

The link to terra's plot help pages is confusing here, as described in this issue: https://github.com/geocompx/geocompr/issues/924

I suspect this is an issue with the underlying downlit package but, after looking for hints there, think that here is a good place to open the issue because bookdown should allow overriding default autolinking behaviour I imagine.

The example is not minimal but is contained in a well established reproducible book: https://r.geocompx.org/

xfun::session_info('bookdown')
``` R version 4.2.2 Patched (2022-11-10 r83330) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 22.04.2 LTS, RStudio 2022.12.0.353 Locale: LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C Package version: base64enc_0.1.3 bookdown_0.32 bslib_0.4.2 cachem_1.0.6 cli_3.6.0 digest_0.6.31 ellipsis_0.3.2 evaluate_0.20 fastmap_1.1.0 fs_1.6.1 glue_1.6.2 graphics_4.2.2 grDevices_4.2.2 highr_0.10 htmltools_0.5.4 jquerylib_0.1.4 jsonlite_1.8.4 knitr_1.42 lifecycle_1.0.3 magrittr_2.0.3 memoise_2.0.1 methods_4.2.2 mime_0.12 R6_2.5.1 rappdirs_0.3.3 rlang_1.0.6 rmarkdown_2.20 sass_0.4.5 stats_4.2.2 stringi_1.7.12 stringr_1.5.0 tinytex_0.44 tools_4.2.2 utils_4.2.2 vctrs_0.5.2 xfun_0.37 yaml_2.3.7 Warning messages: 1: In split_chapters(output = output, build = function(...) bs4_book_page(..., : You have 18 Rmd input file(s) but only 17 first-level heading(s). Did you forget first-level headings in certain Rmd files? 2: In split_chapters(output = output, build = function(...) bs4_book_page(..., : You have 18 Rmd input file(s) but only 17 first-level heading(s). Did you forget first-level headings in certain Rmd files? ```
Robinlovelace commented 1 year ago

Source: https://r.geocompx.org/spatial-class.html#intro-sf