Pandoc stdout support

It seems as though rmarkdown::render assumes that pandoc's output should always be written to a file. This results in errors when attempting to utilize pandoc's stdout feature. Is there another rmarkdown method that supports this use case, and/or any reason this isn't currently supported?

From Pandoc

Write output to FILE instead of stdout . If FILE is - , output will go to stdout

1 Like

I probably don't have the solution you're looking for, but why not just knit your Rmd document to whatever intermediate format would get input to pandoc and just call pandoc directly for stdout capabilities?

For example, you could just knit your Rmd to md or TeX and then call pandoc directly from the command-line (or via system()). Does this get your closer to what you want?

I think some combination of this workflow could get us a little closer, but it seems as though we would still be assuming some burden of maintaining temp files, and that's ultimately what we're trying to avoid

I think this can be avoided programmatically via R by kniting the Rmd output to tempfile()/tempdir(). Then calling pandoc from R and using the tempfile() as the input to pandoc. This avoids having temp files floating around that serve as an eyesore or need to be manually managed

This could definitely be spun up into a simple function/script for reuse.

1 Like

Ahh very interesting! I was not aware of this method.. will definitely give it a shot then. Thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.