From 3128b0ef3beb2372099d719fa95169c99ccedd8f Mon Sep 17 00:00:00 2001 From: Jay Hesselberth Date: Thu, 8 Aug 2024 06:35:17 -0600 Subject: [PATCH] Test math rendering in examples Part of #2704 --- R/test.R | 18 ++++++++++++++++-- man/index.Rd | 1 + man/test-crayon.Rd | 1 + man/test-dont.Rd | 1 + man/test-figures.Rd | 1 + man/test-links.Rd | 1 + man/test-lists.Rd | 1 + man/test-long-lines.Rd | 1 + man/test-math-examples.Rd | 33 +++++++++++++++++++++++++++++++++ man/test-output-styles.Rd | 1 + man/test-params.Rd | 1 + man/test-sexpr-title.Rd | 1 + man/test-tables.Rd | 1 + man/test-verbatim.Rd | 1 + pkgdown/_pkgdown.yml | 1 + 15 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 man/test-math-examples.Rd diff --git a/R/test.R b/R/test.R index b3e01d286..db9928ddd 100644 --- a/R/test.R +++ b/R/test.R @@ -129,7 +129,7 @@ NULL #' x <- 4 #' } #' x # should be 1 -#' +#' #' # \dontshow{} ------------------------------------------------------- #' # never shown, always run #' @@ -145,7 +145,7 @@ NULL #' # If FALSE, wrapped in if; if TRUE, not seen #' #' x <- 1 -#' +#' #' @examplesIf FALSE #' x <- 2 #' @examplesIf TRUE @@ -275,3 +275,17 @@ NULL #' @keywords internal #' @family tests NULL + +#' Test case: math rendering in examples +#' +#' @param x \eqn{f(x) > 0}: inline equation +#' +#' @details +#' Display equation: +#' +#' \deqn{y = \alpha + \beta X + \varepsilon} +#' +#' @name test-math-examples +#' @keywords internal +#' @family tests +NULL diff --git a/man/index.Rd b/man/index.Rd index 71dc7bcba..da52d62fc 100644 --- a/man/index.Rd +++ b/man/index.Rd @@ -15,6 +15,7 @@ Other tests: \code{\link{test-links}}, \code{\link{test-lists}}, \code{\link{test-long-lines}}, +\code{\link{test-math-examples}}, \code{\link{test-output-styles}}, \code{\link{test-params}}, \code{\link{test-sexpr-title}}, diff --git a/man/test-crayon.Rd b/man/test-crayon.Rd index aa779cb85..1597f40ea 100644 --- a/man/test-crayon.Rd +++ b/man/test-crayon.Rd @@ -22,6 +22,7 @@ Other tests: \code{\link{test-links}}, \code{\link{test-lists}}, \code{\link{test-long-lines}}, +\code{\link{test-math-examples}}, \code{\link{test-output-styles}}, \code{\link{test-params}}, \code{\link{test-sexpr-title}}, diff --git a/man/test-dont.Rd b/man/test-dont.Rd index e4b923f7f..c0b63c0ec 100644 --- a/man/test-dont.Rd +++ b/man/test-dont.Rd @@ -72,6 +72,7 @@ Other tests: \code{\link{test-links}}, \code{\link{test-lists}}, \code{\link{test-long-lines}}, +\code{\link{test-math-examples}}, \code{\link{test-output-styles}}, \code{\link{test-params}}, \code{\link{test-sexpr-title}}, diff --git a/man/test-figures.Rd b/man/test-figures.Rd index 208b1a3e6..fce8b4294 100644 --- a/man/test-figures.Rd +++ b/man/test-figures.Rd @@ -22,6 +22,7 @@ Other tests: \code{\link{test-links}}, \code{\link{test-lists}}, \code{\link{test-long-lines}}, +\code{\link{test-math-examples}}, \code{\link{test-output-styles}}, \code{\link{test-params}}, \code{\link{test-sexpr-title}}, diff --git a/man/test-links.Rd b/man/test-links.Rd index 55ef9507e..201255be3 100644 --- a/man/test-links.Rd +++ b/man/test-links.Rd @@ -22,6 +22,7 @@ Other tests: \code{\link{test-figures}}, \code{\link{test-lists}}, \code{\link{test-long-lines}}, +\code{\link{test-math-examples}}, \code{\link{test-output-styles}}, \code{\link{test-params}}, \code{\link{test-sexpr-title}}, diff --git a/man/test-lists.Rd b/man/test-lists.Rd index edef2f8c7..f3dbdce2d 100644 --- a/man/test-lists.Rd +++ b/man/test-lists.Rd @@ -55,6 +55,7 @@ Other tests: \code{\link{test-figures}}, \code{\link{test-links}}, \code{\link{test-long-lines}}, +\code{\link{test-math-examples}}, \code{\link{test-output-styles}}, \code{\link{test-params}}, \code{\link{test-sexpr-title}}, diff --git a/man/test-long-lines.Rd b/man/test-long-lines.Rd index 39cd7cb03..660f29363 100644 --- a/man/test-long-lines.Rd +++ b/man/test-long-lines.Rd @@ -23,6 +23,7 @@ Other tests: \code{\link{test-figures}}, \code{\link{test-links}}, \code{\link{test-lists}}, +\code{\link{test-math-examples}}, \code{\link{test-output-styles}}, \code{\link{test-params}}, \code{\link{test-sexpr-title}}, diff --git a/man/test-math-examples.Rd b/man/test-math-examples.Rd new file mode 100644 index 000000000..de64ccaae --- /dev/null +++ b/man/test-math-examples.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/test.R +\name{test-math-examples} +\alias{test-math-examples} +\title{Test case: math rendering in examples} +\arguments{ +\item{x}{\eqn{f(x) > 0}: inline equation} +} +\description{ +Test case: math rendering in examples +} +\details{ +Display equation: + +\deqn{y = \alpha + \beta X + \varepsilon} +} +\seealso{ +Other tests: +\code{\link{index}}, +\code{\link{test-crayon}}, +\code{\link{test-dont}}, +\code{\link{test-figures}}, +\code{\link{test-links}}, +\code{\link{test-lists}}, +\code{\link{test-long-lines}}, +\code{\link{test-output-styles}}, +\code{\link{test-params}}, +\code{\link{test-sexpr-title}}, +\code{\link{test-tables}}, +\code{\link{test-verbatim}} +} +\concept{tests} +\keyword{internal} diff --git a/man/test-output-styles.Rd b/man/test-output-styles.Rd index 674cdc0ef..dc6645ab8 100644 --- a/man/test-output-styles.Rd +++ b/man/test-output-styles.Rd @@ -31,6 +31,7 @@ Other tests: \code{\link{test-links}}, \code{\link{test-lists}}, \code{\link{test-long-lines}}, +\code{\link{test-math-examples}}, \code{\link{test-params}}, \code{\link{test-sexpr-title}}, \code{\link{test-tables}}, diff --git a/man/test-params.Rd b/man/test-params.Rd index 3439897b3..393a2390c 100644 --- a/man/test-params.Rd +++ b/man/test-params.Rd @@ -18,6 +18,7 @@ Other tests: \code{\link{test-links}}, \code{\link{test-lists}}, \code{\link{test-long-lines}}, +\code{\link{test-math-examples}}, \code{\link{test-output-styles}}, \code{\link{test-sexpr-title}}, \code{\link{test-tables}}, diff --git a/man/test-sexpr-title.Rd b/man/test-sexpr-title.Rd index ad502afa3..f64961005 100644 --- a/man/test-sexpr-title.Rd +++ b/man/test-sexpr-title.Rd @@ -15,6 +15,7 @@ Other tests: \code{\link{test-links}}, \code{\link{test-lists}}, \code{\link{test-long-lines}}, +\code{\link{test-math-examples}}, \code{\link{test-output-styles}}, \code{\link{test-params}}, \code{\link{test-tables}}, diff --git a/man/test-tables.Rd b/man/test-tables.Rd index 5a27a2ad9..cf3e14784 100644 --- a/man/test-tables.Rd +++ b/man/test-tables.Rd @@ -18,6 +18,7 @@ Other tests: \code{\link{test-links}}, \code{\link{test-lists}}, \code{\link{test-long-lines}}, +\code{\link{test-math-examples}}, \code{\link{test-output-styles}}, \code{\link{test-params}}, \code{\link{test-sexpr-title}}, diff --git a/man/test-verbatim.Rd b/man/test-verbatim.Rd index a2d74128b..6ece64f32 100644 --- a/man/test-verbatim.Rd +++ b/man/test-verbatim.Rd @@ -45,6 +45,7 @@ Other tests: \code{\link{test-links}}, \code{\link{test-lists}}, \code{\link{test-long-lines}}, +\code{\link{test-math-examples}}, \code{\link{test-output-styles}}, \code{\link{test-params}}, \code{\link{test-sexpr-title}}, diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index ef9b21dca..7bd5bcd6d 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -17,6 +17,7 @@ authors: template: bootstrap: 5 + math-rendering: mathjax light-switch: true bslib: primary: "#0054AD"