From 12ba5b48c73292144bbaedac8bc350cd16d4a2f4 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Thu, 4 Apr 2024 16:45:10 -0500 Subject: [PATCH] a temporary workaround for https://github.com/davidgohel/flextable/issues/621 --- R/utils.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/utils.R b/R/utils.R index ca99c73aeb..68dd6d6d22 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1054,6 +1054,11 @@ raw_block = function(x, type = 'latex', ...) { if (!rmarkdown::pandoc_available('2.0.0')) warning('raw_block() requires Pandoc >= 2.0.0') x = fenced_block(x, attr = paste0('=', type)) x = gsub('^\n|\n$', '', x) + # TODO: get rid of this hack for davidgohel/flextable#621 + if ('flextable' %in% xfun:::sys.packages() && packageVersion('flextable') <= '0.9.5') { + x = gsub('^(\\s*)```+', '\\1```', x) + x = gsub('```+(\\s*)$', '```\\1', x) + } asis_output(x, ...) }