diff --git a/package.json b/package.json index 327f103c2..861c79171 100644 --- a/package.json +++ b/package.json @@ -1316,6 +1316,11 @@ "default": false, "markdownDescription": "Should the output file be opened automatically when using knit?\n\nRequires `#r.rmarkdown.knit.useBackgroundProcess#` to be set to `true`." }, + "r.rmarkdown.knit.command": { + "type": "string", + "default": "rmarkdown::render", + "markdownDescription": "Command used to knit a Rmd file if not specified by the frontmatter." + }, "r.rmarkdown.knit.defaults.knitWorkingDirectory": { "type": "string", "default": "document directory", diff --git a/src/rmarkdown/knit.ts b/src/rmarkdown/knit.ts index b256ded80..55aeb1f2a 100644 --- a/src/rmarkdown/knit.ts +++ b/src/rmarkdown/knit.ts @@ -105,7 +105,7 @@ export class RMarkdownKnitManager extends RMarkdownManager { } // precedence: - // knit > site > none + // knit > site > configuration if (yamlParams?.['knit']) { const knitParam = yamlParams['knit']; knitCommand = outputFormat ? @@ -116,9 +116,10 @@ export class RMarkdownKnitManager extends RMarkdownManager { `rmarkdown::render_site(${docPath}, output_format = '${outputFormat}')` : `rmarkdown::render_site(${docPath})`; } else { + const cmd = util.config().get('rmarkdown.knit.command'); knitCommand = outputFormat ? - `rmarkdown::render(${docPath}, output_format = '${outputFormat}')` : - `rmarkdown::render(${docPath})`; + `${cmd}(${docPath}, output_format = '${outputFormat}')` : + `${cmd}(${docPath})`; } return knitCommand.replace(/['"]/g, '\'');