From 02652c0392862851087c89415a452d8c3225de9d Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Thu, 30 May 2024 08:57:36 -0400 Subject: [PATCH] Use `vapply()` when performing base64-encoding --- R/utils.R | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/R/utils.R b/R/utils.R index ae9bede250..4fb0357ecf 100644 --- a/R/utils.R +++ b/R/utils.R @@ -721,9 +721,17 @@ process_text <- function(text, context = "html") { ) # Use base64 encoding to avoid issues with escaping internal double - # quotes; used in conjunction with the 'data-qmd-base64' attribute + # quotes; used in conjunction with the 'data-qmd-base64' attribute # that is recognized by Quarto - non_na_text <- base64enc::base64encode(charToRaw(non_na_text)) + non_na_text <- + vapply( + non_na_text, + FUN.VALUE = character(1L), + USE.NAMES = FALSE, + FUN = function(text) { + base64enc::base64encode(charToRaw(text)) + } + ) non_na_text <- tidy_gsub(non_na_text, "^", "
")