% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/knitr_hook.R
\name{ggtibble-knitr-hook}
\alias{ggtibble-knitr-hook}
\alias{ggtibble_opts_hook}
\title{Knitr/Quarto chunk option for rendering ggtibble objects}
\usage{
ggtibble_opts_hook(options)
}
\arguments{
\item{options}{The chunk option list passed by knitr.}
}
\value{
The (possibly modified) chunk option list.
}
\description{
Setting the chunk option \code{ggtibble} triggers a knitr \code{opts_hooks} callback
that sets the chunk label, sets \code{fig.cap} (or \code{fig.subcap} under Quarto when
the ggtibble has multiple captions), and injects a call to \code{knit_print()} if
the chunk body is empty.
}
\details{
The chunk option value may be either:
\itemize{
\item a character string holding R code that evaluates to a \code{ggtibble} object
(e.g. \code{ggtibble = "my_obj"} or \code{ggtibble = "targets::tar_read(my_obj)"}).
With the string form a chunk label is derived automatically.
\item a \code{ggtibble} object directly (e.g. \code{ggtibble = my_obj}). With the object
form the chunk label is not auto-derived; set \code{label = ...} explicitly if
you want a non-default label.
}

Under Quarto (detected via the \code{QUARTO_VERSION} environment variable) the
auto-derived label is prefixed with \code{"fig-"} so \verb{@fig-...} cross-references
work, and a multi-caption ggtibble is rendered using \code{fig.subcap} because
Quarto's cross-reference resolver does not handle vector \code{fig.cap} on a
\verb{fig-} labelled chunk.
}
\keyword{internal}
