Skip to content

Anchor is to file name instead of an alias defined on the file #1709

@llrs

Description

@llrs

I was checking one package I'm working on and it reported a note:

checking Rd cross-references ... NOTE
  Non-topic package-anchored link(s) in Rd file 'bioc_cran_archived.Rd':
    ‘[tools:CRANtools]{tools::CRAN_package_db()}’
  
  Non-topic package-anchored link(s) in Rd file 'cran_doom.Rd':
    ‘[tools:CRANtools]{tools::CRAN_package_db()}’
  
  See section 'Cross-references' in the 'Writing R Extensions' manual.

The help file is generated with something like this:

library("roxygen2")
out <- roc_proc_text(rd_roclet(), "
  #' Playing with links
  #'
  #' @seealso [tools::CRAN_package_db()]
  #' @md
  null <- function () NULL
")[[1]]

out
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{null}
#> \alias{null}
#> \title{Playing with links}
#> \usage{
#> null()
#> }
#> \description{
#> Playing with links
#> }
#> \seealso{
#> \code{\link[tools:CRANtools]{tools::CRAN_package_db()}}
#> }

rdfile <- tempfile()
cat(out$format(), file = rdfile)
tools::checkRd(rdfile)
help("CRANtools", package = "tools")
#> No documentation for 'CRANtools' in specified packages and libraries:
#> you could try '??CRANtools'

Created on 2025-04-19 with reprex v2.1.1

The file in question has several alias but the name (CRANtools) is not one of them: CRAN_package_db, CRAN_check_results, CRAN_check_details, CRAN_check_issues, summarize_CRAN_check_status, R_CRAN_WEB, R_CRAN_SRC, CRAN_current_db, CRAN_aliases_db, CRAN_rdxrefs_db, CRAN_archive_db, CRAN_authors_db.

It would be great if it generated a cross reference with the same anchor as the function being used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions