% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/audit-export.R
\name{audit_export}
\alias{audit_export}
\title{Export an Audit Trail as a Self-Contained HTML File}
\usage{
audit_export(.trail, file = NULL)
}
\arguments{
\item{.trail}{An \code{\link[=audit_trail]{audit_trail()}} object.}

\item{file}{Path to the output \code{.html} file. If \code{NULL}
(the default), writes to a temporary file and opens it in the default
browser via \code{\link[utils:browseURL]{utils::browseURL()}}.}
}
\value{
The file path (character), invisibly.
}
\description{
Produces a standalone HTML file that visualises the audit trail as an
interactive pipeline flow diagram. The file is completely self-contained
— no server, internet connection, or R installation is required to view
it. Open it in any browser.
}
\details{
The trail is serialised via \code{\link[=trail_to_list]{trail_to_list()}} and embedded as JSON inside
an HTML template with inline CSS and vanilla JavaScript. The visualisation
features:
\itemize{
\item Horizontal pipeline flow diagram with colour-coded nodes per
operation type (snapshot, join, filter).
\item Edges annotated with key deltas (match rate, drop \\%, columns
added).
\item Clickable nodes expanding to show column schema, operation
diagnostics, and custom \code{.fns} results.
\item Clickable edges showing the full diff between adjacent snapshots.
\item Light / dark theme toggle.
\item Collapsible JSON export panel.
}
}
\examples{
\donttest{
trail <- audit_trail("demo")
mtcars |> audit_tap(trail, "raw")
dplyr::filter(mtcars, mpg > 20) |> audit_tap(trail, "filtered")
audit_export(trail, tempfile(fileext = ".html"))
}

}
\seealso{
\code{\link[=trail_to_list]{trail_to_list()}}, \code{\link[=write_trail]{write_trail()}}

Other audit export:
\code{\link[=read_trail]{read_trail()}},
\code{\link[=trail_to_df]{trail_to_df()}},
\code{\link[=trail_to_list]{trail_to_list()}},
\code{\link[=write_trail]{write_trail()}}
}
\concept{audit export}
