I found out from this question that you can call Knitr from a script like this:
Rscript -e "library(knitr); knit('myfile.Rmd')
But is there a way to get it to use stdin and stdout instead of files?
I tried several variations on
Rscript -e 'library(knitr); knit2html(text=readLines(), output=stdout())'
but none have worked so far.
EDIT: I suppose worst case, I could write a wrapper script that writes stdin to a temp file, calls knitr on it, echoes the output file, and deletes them. But that's kind of ugly :(