Link from vignette to package documentation

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Link from vignette to package documentation

Sigbert Klinke
Hi,

is it possible to make a link from a vignette to a (Rd) help files in my
own or other packages?

Best Sigbert

--
https://hu.berlin/sk
https://hu.berlin/mmstat3


______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Link from vignette to package documentation

Duncan Murdoch-2
On 21/09/2018 4:54 AM, Sigbert Klinke wrote:
> Hi,
>
> is it possible to make a link from a vignette to a (Rd) help files in my
> own or other packages?

Only with some significant compromises.  R normally acts as the web
server for Rd files, and the URL is not really predictable.  So you
would need to make the URL predictable, either by something like

options(help.ports = 12345)

(which will put help on port 12345, blocking that port for any other
use, including help in another R session), or by putting a static copy
of the help pages on some other web server.

Duncan Murdoch

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Link from vignette to package documentation

Martin Maechler
>>>>> Duncan Murdoch
>>>>>     on Fri, 21 Sep 2018 05:02:32 -0400 writes:

    > On 21/09/2018 4:54 AM, Sigbert Klinke wrote:
    >> Hi,
    >>
    >> is it possible to make a link from a vignette to a (Rd)
    >> help files in my own or other packages?

    > Only with some significant compromises.  R normally acts
    > as the web server for Rd files, and the URL is not really
    > predictable.  So you would need to make the URL
    > predictable, either by something like

    > options(help.ports = 12345)

    > (which will put help on port 12345, blocking that port for
    > any other use, including help in another R session), or by
    > putting a static copy of the help pages on some other web
    > server.

    > Duncan Murdoch

Yes, and the other way around -- making working links from
package (*.Rmd or *.Rnw) vignettes to help pages of the same
package is also not easily and portably possible AFAICS.

Both would be desirable quite desirable for improved R
documentation and ideally so in a way that could also work with
an internet connection.

[and if we continue this, it may become more of an issue for
'R-devel' instead of 'R-help' ...]

Martin Maechler

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Link from vignette to package documentation

Duncan Murdoch-2
On 22/09/2018 4:14 AM, Martin Maechler wrote:

>>>>>> Duncan Murdoch
>>>>>>      on Fri, 21 Sep 2018 05:02:32 -0400 writes:
>
>      > On 21/09/2018 4:54 AM, Sigbert Klinke wrote:
>      >> Hi,
>      >>
>      >> is it possible to make a link from a vignette to a (Rd)
>      >> help files in my own or other packages?
>
>      > Only with some significant compromises.  R normally acts
>      > as the web server for Rd files, and the URL is not really
>      > predictable.  So you would need to make the URL
>      > predictable, either by something like
>
>      > options(help.ports = 12345)
>
>      > (which will put help on port 12345, blocking that port for
>      > any other use, including help in another R session), or by
>      > putting a static copy of the help pages on some other web
>      > server.
>
>      > Duncan Murdoch
>
> Yes, and the other way around -- making working links from
> package (*.Rmd or *.Rnw) vignettes to help pages of the same
> package is also not easily and portably possible AFAICS.

Actually I was overly pessimistic above.  If both the vignette and the
help page are being viewed in a web browser, it should be possible using
relative links.

My rgl package does this:  the "rgl Overview" vignette is written in R
Markdown and displayed in HTML.  It has links to the help pages.  There
are some limitations:  the links only work while the same R session is
running.

To make a link to help topic "points3d", it inserts code that produces
the anchor

<a href="../../rgl/help/points3d">`points3d`</a>

in the text.  (It should also work to replace the prefix "../../rgl/"
with just "../", but the longer path allows for links to help pages in
other packages.)

This won't work if you are looking at the vignette somewhere else (e.g.
at https://cran.r-project.org/web/packages/rgl/vignettes/rgl.html).

Duncan Murdoch


>
> Both would be desirable quite desirable for improved R
> documentation and ideally so in a way that could also work with
> an internet connection.
>
> [and if we continue this, it may become more of an issue for
> 'R-devel' instead of 'R-help' ...]
>
> Martin Maechler
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.