Skip to content

Support a _PACKAGE convention for package-level documentation #30

Closed

Description

@TroyHernandez

Motivation

tinyrox generates function topics, but it does not currently recognize
the roxygen2 _PACKAGE sentinel. A package that wants a ?pkgname landing
topic therefore has to maintain an .Rd file by hand.

This came up while preparing subtitles for CRAN: all exported functions were
documented and the checks were clean, but there was no generated package-level
help topic. It is not a CRAN requirement, but it would improve discoverability
and provide a useful bit of roxygen2 compatibility.

Proposed behavior

Recognize a documentation block attached to the conventional sentinel:

#' subtitles: Generate and Render Timed Subtitles
#'
#' Package-level overview and getting-started details.
"_PACKAGE"

For a package named subtitles, generate man/subtitles-package.Rd with:

  • package docType;
  • name subtitles-package;
  • aliases for subtitles and subtitles-package;
  • title, description, and details from the documentation block, with sensible
    DESCRIPTION fallbacks when fields are absent.

The sentinel should not be exported, added to NAMESPACE, or receive an
ordinary object usage section. If the exact sentinel does not fit the
tinyrox design, an explicit tinyrox tag providing the same result would
also work.

Acceptance criteria

  • _PACKAGE is parsed as package documentation rather than an ordinary object.
  • tinyrox::document() deterministically generates the package-level .Rd.
  • ?subtitles resolves through the generated alias.
  • Re-documenting is idempotent, including when prune_rd = TRUE.
  • A fixture/test covers generation and confirms that NAMESPACE is unchanged.

Activity

  1. TroyHernandez commented on Aug 4, 2026

    @TroyHernandez
    ContributorAuthor

    Turns out this already works, and has since well before 0.4.0. Running the exact example from this issue through tinyrox::document() 0.4.0.2 produces man/subtitles-package.Rd with package docType, aliases for subtitles and subtitles-package (so ?subtitles resolves), nothing added to NAMESPACE, and byte-identical output on re-document including with prune_rd = TRUE. Every acceptance criterion above passes; test fixtures exist in inst/tinytest/test_rd.R.

    One design difference from the proposal: since #11, title/description/author/maintainer come from DESCRIPTION at render time via the base-R Rd macros (\packageTitle{}, \packageDescription{}, etc.), and block paragraphs 3+ (or @details) fill \details{}. The block's own title and description paragraphs are intentionally not copied into the Rd, so DESCRIPTION stays the single source of truth.

    The real gap was that none of this was documented, which is why it read as unsupported. #34 adds it to README and CLAUDE.md.

  2. added a commit that references this issue on Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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