Skip to content

Commit d957b3e

Browse files
authored
Merge pull request #11337 from quarto-dev/knitr/rscript-args
Add QUARTO_KNITR_RSCRIPT_ARGS to pass some flags to RScript for knitr engine
2 parents 135024a + 4007a9d commit d957b3e

File tree

3 files changed

+11
-52
lines changed

3 files changed

+11
-52
lines changed

src/execute/rmd.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,19 @@ async function callR<T>(
272272
wd: cwd,
273273
});
274274

275+
// QUARTO_KNITR_RSCRIPT_ARGS allows to pass additional arguments to Rscript as comma separated values
276+
// e.g. QUARTO_KNITR_RSCRIPT_ARGS="--vanilla,--no-init-file,--max-connections=258"
277+
const rscriptArgs = Deno.env.get("QUARTO_KNITR_RSCRIPT_ARGS") || "";
278+
const rscriptArgsArray = rscriptArgs.split(",").filter((a) =>
279+
a.trim() !== ""
280+
);
281+
275282
try {
276283
const result = await execProcess(
277284
{
278285
cmd: [
279286
await rBinaryPath("Rscript"),
287+
...rscriptArgsArray,
280288
resourcePath("rmd/rmd.R"),
281289
],
282290
cwd,

tests/smoke/render/render-required.test.ts

Lines changed: 0 additions & 50 deletions
This file was deleted.

tests/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export function outputForInput(
114114
if (baseFormat === "revealjs") {
115115
outputExt = "html";
116116
}
117-
if (["commonmark", "gfm", "markdown"].some((f) => f === baseFormat)) {
117+
if (["commonmark", "gfm", "markdown", "markdown_strict"].some((f) => f === baseFormat)) {
118118
outputExt = "md";
119119
}
120120
if (baseFormat === "csljson") {
@@ -189,4 +189,5 @@ export function fileLoader(...path: string[]) {
189189
// On Windows, `quarto.cmd` needs to be explicit in `execProcess()`
190190
export function quartoDevCmd(): string {
191191
return Deno.build.os === "windows" ? "quarto.cmd" : "quarto";
192-
}
192+
}
193+

0 commit comments

Comments
 (0)