@@ -157,9 +157,24 @@ execute <- function(input, format, tempDir, libDir, dependencies, cwd, params, r
157
157
}
158
158
}
159
159
160
+ # special internal function for rendering inline code using Quarto syntax
161
+ .assignToQuartoToolsEnv(" .QuartoInlineRender" , function (v ) { # nolint: object_usage_linter, line_length_linter.
162
+ if (is.null(v )) {
163
+ " NULL"
164
+ } else if (inherits(v , " AsIs" )) {
165
+ v
166
+ } else if (is.character(v )) {
167
+ gsub(
168
+ pattern = " (\\ [|\\ ]|[`*_{}()>#+-.!])" ,
169
+ x = v , replacement = " \\\\\\ 1"
170
+ )
171
+ } else {
172
+ v
173
+ }
174
+ })
175
+
160
176
# we need ojs only if markdown has ojs code cells
161
177
# inspect code cells for spaces after line breaks
162
-
163
178
needs_ojs <- grepl(" (\n |^)[[:space:]]*```+\\ {ojs[^}]*\\ }" , markdown )
164
179
# FIXME this test isn't failing in shiny mode, but it doesn't look to be
165
180
# breaking quarto-shiny-ojs. We should make sure this is right.
@@ -173,19 +188,6 @@ execute <- function(input, format, tempDir, libDir, dependencies, cwd, params, r
173
188
local = .quarto_tools_env
174
189
)
175
190
}
176
-
177
- # special internal function for rendering inline code using Quarto syntax
178
- .quarto_tools_env $ .QuartoInlineRender <- function (v ) {
179
- if (is.null(v )) {
180
- " NULL"
181
- } else if (inherits(v , " AsIs" )) {
182
- v
183
- } else if (is.character(v )) {
184
- gsub(pattern = " (\\ [|\\ ]|[`*_{}()>#+-.!])" , x = v , replacement = " \\\\\\ 1" )
185
- } else {
186
- v
187
- }
188
- }
189
191
190
192
render_output <- rmarkdown :: render(
191
193
input = input ,
0 commit comments