Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always resolve to "anchored" Rd xrefs #1612

Closed
Tracked by #1633
jeroen opened this issue Apr 21, 2024 · 5 comments · Fixed by #1633
Closed
Tracked by #1633

Always resolve to "anchored" Rd xrefs #1612

jeroen opened this issue Apr 21, 2024 · 5 comments · Fixed by #1633
Assignees
Labels
feature a feature request or enhancement markdown ⬇️

Comments

@jeroen
Copy link
Member

jeroen commented Apr 21, 2024

In order to improve cross-package links in the new single-page-html documentation, CRAN will start showing NOTEs for Rd pages which link to a topic that exists in multiple CRAN packages, such as toJSON (in jsonlite, RJSONIO, rjson).

Seemingly it is not trivial at CMD check time to resolve a topic to a given based on the package imports/suggests. They suggest you use "anchored" Rd links, which simply means using the full \link[pkg:topic]{topic} syntax.

If possible, way to reduce some of the fallout would be to resolve a [topic] name to the full \link[pkg:topic]{topic} at roxygenize time, by inspecting at the package namespace, i.e. to automatically determine the pkg: value when unset:

#' MARKDOWN LINK TEXT CODE RD
#' -------- --------- ---- --
#' [fun()] fun() T \\link[=fun]{fun()}
#' [obj] obj F \\link{obj}
#' [pkg::fun()] pkg::fun() T \\link[pkg:file]{pkg::fun()}
#' [pkg::obj] pkg::obj F \\link[pkg:file]{pkg::obj}
#' [text][fun()] text F \\link[=fun]{text}
#' [text][obj] text F \\link[=obj]{text}
#' [text][pkg::fun()] text F \\link[pkg:file]{text}
#' [text][pkg::obj] text F \\link[pkg:file]{text}
#' [s4-class] s4 F \\linkS4class{s4}
#' [pkg::s4-class] pkg::s4 F \\link[pkg:file]{pkg::s4}

@hadley hadley added feature a feature request or enhancement markdown ⬇️ labels Jul 9, 2024
@gaborcsardi gaborcsardi self-assigned this Jul 9, 2024
@gaborcsardi
Copy link
Member

Seemingly it is not trivial at CMD check time to resolve a topic to a given based on the package imports/suggests.

...

If possible, way to reduce some of the fallout would be to resolve a [topic] name to the full \link[pkg:topic]{topic} at roxygenize time,

So, to be clear, they don't want to do this, but they want us to do it? :D

@gaborcsardi
Copy link
Member

Btw. anyone knows a package that has this issue?

@gaborcsardi
Copy link
Member

Btw.2. Is this change documented anywhere? I can't see anything in `Writing R Externsions'. It would be good to know the rules before we update roxygen2. E.g. are unqualified links to base packages allowed?

@jeroen
Copy link
Member Author

jeroen commented Jul 9, 2024 via email

@gaborcsardi
Copy link
Member

From the check message it seems that references to base packages do not need to be qualified:

  Please provide package anchors for all Rd \link{} targets not in the
  package itself and the base packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement markdown ⬇️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants