diff --git a/NAMESPACE b/NAMESPACE index 1c22ad5af..ef7bc3b4e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -41,7 +41,6 @@ export(add_card_button_ui) export(as.teal_report) export(as_yaml_auto) export(code_chunk) -export(code_output) export(doc) export(download_report_button_srv) export(download_report_button_ui) diff --git a/R/doc.R b/R/doc.R index 4b248129f..8bbc7b6c1 100644 --- a/R/doc.R +++ b/R/doc.R @@ -185,7 +185,6 @@ edit_doc <- function(x, modify = NULL, append = NULL, after = length(x)) { #' class(my_chunk) #' attributes(my_chunk)$param #' @export -#' @rdname code_output code_chunk <- function(code, ...) { checkmate::assert_character(code) params <- list(...) @@ -196,22 +195,6 @@ code_chunk <- function(code, ...) { ) } -#' Format R code as a simple Markdown code block string -#' -#' This function takes a character string of R code and wraps it in -#' Markdown's triple backticks for code blocks. -#' -#' @param code A character string containing the R code. -#' @return A character string representing a simple Markdown code block. -#' @seealso [code_chunk()] for creating structured code chunk objects with options. -#' @examples -#' code_output("y <- rnorm(5)") -#' @export -#' @rdname code_output -code_output <- function(code) { - sprintf("```\n%s\n```", code) -} - #' @title Keep Objects In Report #' @description Utility function to change behavior of `doc` elements to be #' kept (`keep = TRUE`) or discarded (`keep = FALSE`) from the final `.Rmd` file containing the downloaded report. diff --git a/man/code_output.Rd b/man/code_chunk.Rd similarity index 69% rename from man/code_output.Rd rename to man/code_chunk.Rd index 35f153b6b..42fb8d904 100644 --- a/man/code_output.Rd +++ b/man/code_chunk.Rd @@ -2,12 +2,9 @@ % Please edit documentation in R/doc.R \name{code_chunk} \alias{code_chunk} -\alias{code_output} \title{Generate an R Markdown code chunk} \usage{ code_chunk(code, ...) - -code_output(code) } \arguments{ \item{code}{A character string containing the R code.} @@ -16,23 +13,14 @@ code_output(code) } \value{ An object of class \code{code_chunk}. - -A character string representing a simple Markdown code block. } \description{ This function creates a \code{code_chunk} object, which represents an R Markdown code chunk. It stores the R code and any specified chunk options (e.g., \code{echo}, \code{eval}). These objects are typically processed later to generate the final R Markdown text. - -This function takes a character string of R code and wraps it in -Markdown's triple backticks for code blocks. } \examples{ my_chunk <- code_chunk("x <- 1:10", echo = TRUE, message = FALSE) class(my_chunk) attributes(my_chunk)$param -code_output("y <- rnorm(5)") -} -\seealso{ -\code{\link[=code_chunk]{code_chunk()}} for creating structured code chunk objects with options. } diff --git a/tests/testthat/test-doc.R b/tests/testthat/test-doc.R index cbc8c85d9..14aa396c6 100644 --- a/tests/testthat/test-doc.R +++ b/tests/testthat/test-doc.R @@ -126,12 +126,6 @@ testthat::test_that("code_chunk creates a code_chunk object with params", { testthat::expect_equal(attributes(chunk)$params, list(echo = FALSE, eval = TRUE)) }) -testthat::test_that("code_output formats code as markdown string", { - output <- code_output("x <- 1") - testthat::expect_type(output, "character") - testthat::expect_equal(output, "```\nx <- 1\n```") -}) - testthat::test_that("keep_in_report sets the 'keep' attribute", { obj1 <- "some text" kept_obj1 <- keep_in_report(obj1, TRUE)