roxygen2 icon indicating copy to clipboard operation
roxygen2 copied to clipboard

Link from function docs to package website

Open mine-cetinkaya-rundel opened this issue 3 years ago • 6 comments

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.

mine-cetinkaya-rundel avatar Feb 23 '22 16:02 mine-cetinkaya-rundel

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

hadley avatar Mar 29 '22 18:03 hadley

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

mine-cetinkaya-rundel avatar Mar 29 '22 23:03 mine-cetinkaya-rundel

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

hadley avatar Mar 30 '22 12:03 hadley

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.

mine-cetinkaya-rundel avatar Mar 30 '22 12:03 mine-cetinkaya-rundel

We could inject some HTML that creates the button?

gaborcsardi avatar Mar 30 '22 12:03 gaborcsardi

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.

hadley avatar Mar 31 '22 11:03 hadley