I want to create a VS-Code Task, that executs a R command to convert markdown into PDF. My current Task looks like this:
{
"label": "rmarkdown -> pdf",
"type": "process",
"command": "Rscript",
"args": ["-e", "\"rmarkdown::render('${file}', 'pdf_document')\""],
"windows": true,
"presentation": {
"reveal": "always",
"panel": "new"
}
}
The problem ist, that ${file}
returns a path like this:
d:\data\documents\myFile.md
but R needs a path with escaped backslashs like this:
d:\\data\\documents\\myFile.md
how to get a escaped path from ${file}
?
Alternative a path with normal slashs will do the job as well, because R will automaticaly replace /
to \\
.