Got errors from rmarkdown::render() with intermediates_dir specified


#1

I had used rmarkdown::render() with intermediates_dir specified for quite a while without problems, but i get errors now. Below are two simple example files, test.Rmd and run_R, that give me the errors.

test.Rmd:

---
date: "`r Sys.Date()`"
output:
  html_document:
    toc: true
    lib_dir: libs
params:
    title: "Test"
---
---
title: `r params$title`
---

Just a test file.

## Session Info
```{r session_info, echo=FALSE}
sessionInfo();
```

run_R:

#!/usr/bin/env Rscript

library(rmarkdown)
rmarkdown::render(input = "test.Rmd", output_file = "test.html", intermediates_dir=".")

When I ran the Rscript (you may directly run the R codes within R), I got the following error:

pandoc: Could not parse YAML header: found character that cannot start any token "source" (line 12, column 8)
Error in stri_replace_all_regex(x, c("\\$", "\\\\(\\d)"), c("\\\\$", "\\$$1"),  :
  argument `str` should be a character vector (or an object coercible to)
Calls: <Anonymous> ... <Anonymous> -> fix_replacement -> stri_replace_all_regex -> .Call
Execution halted

If the intermediates_dir option is not specified, it will create the output file as expected. The session info shows rmarkdown_1.9. I'm wondering if someone can duplicate the error. Thanks.