From a3dc3b176de8477fb88d517f54f366178e9e01b0 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Fri, 17 Nov 2023 15:13:31 +0100 Subject: [PATCH] Don't show cell-output-display div when `output: asis` Follow up on #4703 and trying to solve #7600 --- src/resources/rmd/hooks.R | 1 + src/resources/rmd/patch.R | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/resources/rmd/hooks.R b/src/resources/rmd/hooks.R index a8d7242b8d2..567e90c3441 100644 --- a/src/resources/rmd/hooks.R +++ b/src/resources/rmd/hooks.R @@ -672,6 +672,7 @@ knitr_plot_hook <- function(format) { # result = "asis" specific if (identical(options[["results"]], "asis")) return(md) + # enclose in output div output_div(md, NULL, classes) } diff --git a/src/resources/rmd/patch.R b/src/resources/rmd/patch.R index e037d15b814..e2e00e4d70c 100644 --- a/src/resources/rmd/patch.R +++ b/src/resources/rmd/patch.R @@ -111,6 +111,9 @@ wrap_asis_output <- function(options, x) { x <- paste0("`````{=html}\n", x, "\n`````") } + # If asis output, don't include the output div + if (identical(options[["results"]], "asis")) return(x) + output_div(x, output_label_placeholder(options), classes, attrs) }