r-lib/downlit

Feature request: keep track of autolinks

larmarange opened this issue · 2 comments

Would it be a way to keep a track of identified autolinks, for example by saving a tibble indicating the list of links (name, link, type ie function package or vignette, the source file, etc.)?

Such functionality could be useful to generate an index of functions or an index of packages in books created with bookdownor quarto.

See quarto-dev/quarto-cli#2747

I second that feature. This would also make it possible to auto-generate tooltips as suggested in #18 by using fairly straightforward post processing of the generated articles.

read autolink tibble -> query Rd documentation -> render tooltips -> patch articles/*.html

I've played around with auto-generating tooltips a few weeks ago and found that this would be a reasonable representation of the autolink tibble for this usecase

type reference url
package downlit https://downlit.r-lib.org/
article cli::progress https://cli.r-lib.org/articles/progress.html
manpage downlit::autolink https://downlit.r-lib.org/reference/autolink.html

The post-processing would then be something like this

readRDS("pkgdown/built/autolinks.rds") %>%
  add_tooltips(join_by = c("type", "reference")) %>%
  patch_articles("articles/*.html", join_by = "url")
hadley commented

This sounds like an interesting idea, but I think it's out of scope for downlit.