Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 4 additions & 3 deletions src/rmarkdown/knit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?
Expand All @@ -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<string>('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, '\'');
Expand Down