This function checks the current environment to determine whether the code is being run in an interactive session (like RStudio), or as part of rendering an HTML or PDF document.

get_output_format(manual_format = NULL)

Arguments

manual_format

An optional string specifying the format. If provided, this overrides the automatic detection.

Value

A string indicating the detected format: "studio" for interactive sessions, "html" for HTML output, or "pdf" for PDF output.

Examples

# Automatic detection
get_output_format()
#> [1] "studio"

# Manual override
get_output_format("pdf")
#> [1] "pdf"