downlit icon indicating copy to clipboard operation
downlit copied to clipboard

Feature request: keep track of autolinks

Open larmarange opened this issue 1 year ago • 1 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 https://github.com/quarto-dev/quarto-cli/discussions/2747

larmarange avatar Oct 10 '22 11:10 larmarange

I second that feature. This would also make it possible to auto-generate tooltips as suggested in https://github.com/r-lib/downlit/issues/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")

GregorDeCillia avatar Oct 16 '22 14:10 GregorDeCillia