use_fyi_docs

Generate Individual Documentation Files

Description

Creates a directory of individual markdown files, one per help topic. LLMs can read these on-demand when they need details about specific functions.

Usage

use_fyi_docs(
  package,
  dir = "man-md",
  pattern = NULL,
  topics = NULL,
  exclude = NULL,
  exports_only = FALSE,
  clean = TRUE,
  format = "default"
)

Arguments

  • package: Character. Package name.
  • dir: Directory to write files. Default “man-md” in current directory.
  • pattern: Optional regex to filter which topics to include.
  • topics: Optional character vector of specific topics to include.
  • exclude: Optional regex pattern to exclude topics.
  • exports_only: Logical. Only include docs for exported functions? Default FALSE.
  • clean: Logical. Remove existing files in dir first? Default TRUE.
  • format: Output format: “default” (HTML comments) or “hugo” (YAML front matter).

Value

Character vector of generated file paths, invisibly.

Examples

# Generate all doc files
use_fyi_docs("sttapi")

# Filter to specific patterns (torch example)
use_fyi_docs("torch", pattern = "^nn_")      # Neural network modules
use_fyi_docs("torch", pattern = "^optim_")   # Optimizers
use_fyi_docs("torch", pattern = "^torch_")   # Tensor operations

# Specific topics only
use_fyi_docs("torch", topics = c("nn_linear", "nn_conv2d", "nn_module"))

# Exclude patterns
use_fyi_docs("torch", exclude = "^nnf_")     # Skip functional variants

# Only exported functions (skip internal helper docs)
use_fyi_docs("torch", exports_only = TRUE)

# Hugo format for static sites
use_fyi_docs("sttapi", format = "hugo")