r-lib / roxygen2

Generate R package documentation from inline R comments
https://roxygen2.r-lib.org
Other
597 stars 234 forks source link

Link from function docs to package website #1294

Open mine-cetinkaya-rundel opened 2 years ago

mine-cetinkaya-rundel commented 2 years ago

This is a feature request to add a link to each function's documentation that said something like "read on package website" that takes you there. Ideally the link would take you to the function documentation directly, but it could also be a generic link that is the same for all functions that takes you to the Reference page of the package website.

The motivation for this request is that ?foo is very easy to learn/teach but what you get is a much more subpar documentation reading experience than reading on the package website, particularly for examples. Also, the more I'm teaching with library(tidyverse) and library(tidymodels), the less the names of individual packages come up, so students sometimes have no idea which package website to go to find function information.

hadley commented 2 years ago

Where do you think it should appear on the documentation page?

mine-cetinkaya-rundel commented 2 years ago

I think it should appear pretty high up, as not everyone will scroll down. Something like an "open in browser" icon (though it does more than opening that file in the browser) or something like a badge?

opt-1 opt-2
hadley commented 2 years ago

That'd be pretty hard to do from from roxygen2; maybe it could be an IDE feature instead?

mine-cetinkaya-rundel commented 2 years ago

That was my first instinct too, but then I thought this is useful to know even if you don't use RStudio.

What about something simpler like the function title being a URL? And there could, in addition, be an IDE feature that's makes it a bit more clear like in these examples.

gaborcsardi commented 2 years ago

We could inject some HTML that creates the button?

hadley commented 2 years ago

The more I think about it, the more I think this should be handled by the API — if we inject it with roxygen, we'd also need to add parallel handling in pkgdown to strip it out.