Skip to content

Render @section blocks in function and @rdname Rd output#16

Merged
TroyHernandez merged 3 commits into
mainfrom
fix/render-section-blocks
Jun 7, 2026
Merged

Render @section blocks in function and @rdname Rd output#16
TroyHernandez merged 3 commits into
mainfrom
fix/render-section-blocks

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

Closes #10.

@section Name: blocks were parsed into tags$sections by parse_tags(), but only generate_package_rd() emitted them. For ordinary exported functions and @rdname groups, the section was silently dropped, so ?fn showed nothing. This bit corteza::subagent_spawn(), whose @section Permissions: block (documenting the no-mid-run-escalation invariant) never reached the Rd.

Changes

  • Add a render_sections() helper that emits \section{title}{content} per parsed section (content passed through as Rd, consistent with tinyrox's no-markdown stance).
  • Call it from generate_rd() and generate_rd_grouped() (after \details, matching roxygen2 placement). The grouped path concatenates sections from every member of the @rdname group.
  • Refactor generate_package_rd() to use the same helper (no output change there).

Tests

  • test_rd.R: parse → generate round-trip for a single section (the issue's exact repro), a multi-word title, multiple ordered sections, and a no-section negative check.
  • test_rdname.R: sections gathered from all members of an @rdname group.

Verified end-to-end on the issue's repro: generated Rd contains \section{Permissions}{...} and parses clean via tools::parse_Rd(). Full suite: 173 pass, 0 fail.

@section was parsed into tags$sections but only emitted by the package
Rd generator. For ordinary exported functions and @Rdname groups the
section was silently dropped, so a documented invariant (e.g. corteza's
subagent_spawn Permissions section) never reached the generated Rd.

Add a render_sections() helper and call it from generate_rd() and
generate_rd_grouped() (after \details, like roxygen2), gathering sections
from every member of an @Rdname group. Refactor generate_package_rd() to
use the same helper. Fixes #10.
@TroyHernandez TroyHernandez merged commit db1ea3c into main Jun 7, 2026
4 checks passed
@TroyHernandez TroyHernandez deleted the fix/render-section-blocks branch June 7, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tinyrox drops roxygen @section blocks when generating Rd

1 participant