Skip to content

Commit

Permalink
allow global setting of preview
Browse files Browse the repository at this point in the history
  • Loading branch information
philchalmers committed Sep 9, 2024
1 parent 139df8f commit 47dfb21
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 6 additions & 3 deletions R/Eqn.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
#' each \code{matrix} object supplied. If further specificity is required create
#' \code{\link{latexMatrix}} objects directly.
#' @param preview logical; render an HTML version of the equation and display? This is intended for
#' testing purposes and is only applicable to interactive R sessions. Disabled
#' whenever \code{quarto} or \code{html_output} are \code{TRUE}
#' testing purposes and is only applicable to interactive R sessions, though
#' for code testing purposes can be set globally
#' via \code{\link{options}} (e.g., \code{options('previewEqn' = FALSE)}).
#' Disabled whenever \code{quarto} or \code{html_output} are \code{TRUE}
#' @returns NULL
#' @importFrom knitr is_html_output
#' @importFrom rstudioapi viewer
Expand Down Expand Up @@ -112,7 +114,7 @@
Eqn <- function(...,
label = NULL,
align = FALSE,
preview = TRUE,
preview = getOption('previewEqn'),
html_output = knitr::is_html_output(),
quarto = getOption('quartoEqn'),
mat_args = list()) {
Expand All @@ -126,6 +128,7 @@ Eqn <- function(...,
}
}
on.exit(sink.reset())
if(is.null(preview)) preview <- TRUE
quarto <- setQuartoEqn(quarto)
if(is.null(quarto)) quarto <- FALSE
preview <- preview && interactive()
Expand Down
8 changes: 5 additions & 3 deletions man/Eqn.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 47dfb21

Please sign in to comment.