R/as_is.R

Defines functions add_class as_md as_is

Documented in as_is as_md

#' Mark as a node to inject as is
#'
#' @param x raw ooxml passed through [as_xml_node()]
#'
#' @inheritParams rlang::args_error_context
#'
#' @returns adds the class "as_is" to the input text the content "as is" and not
#'   modify it when polishing
#'
#' @export
as_is <- function(x, error_call = current_env()) {
  add_class(x, "as_is")
}

#' Mark text as markdown
#'
#' @param x text to be interpreted as markdown
#'
#' @returns adds the class "as_ms" to the input text the content "as markdown"
#'   apply markdown formatting to the text when polishing
#'
#' @export
as_md <- function(x) {
  add_class(x, "as_md")
}

add_class <- function(x, class = NULL) {
  class(x) <- c(class, setdiff(class(x), class))
  x
}

Try the polish package in your browser

Any scripts or data that you put into this service are public.

polish documentation built on June 3, 2026, 5:07 p.m.