Skip to content

Commit 8da5acc

Browse files
committed
Escape input to cli_abort()
1 parent 274c1f4 commit 8da5acc

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

R/build-article.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ wrap_rmarkdown_error <- function(cnd, input, call = caller_env()) {
290290
cli::cli_abort(
291291
c(
292292
"!" = "Failed to render {.path {input}}.",
293-
set_names(lines, "x")
293+
set_names(cli_escape(lines), "x")
294294
),
295295
parent = cnd$parent %||% cnd,
296296
trace = cnd$parent$trace,

R/utils.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,9 @@ print.pkgdown_xml <- function(x, ...) {
227227
cat(as.character(x, options = c("format", "no_declaration")), sep = "\n")
228228
invisible(x)
229229
}
230+
231+
cli_escape <- function(x) {
232+
x <- gsub("{", "{{", x, fixed = TRUE)
233+
x <- gsub("}", "}}", x, fixed = TRUE)
234+
x
235+
}

0 commit comments

Comments
 (0)