Solution 1 :

marked outputs to standard out by default, and wkhtmltopdf can read from stdin if you specify - as the file to read, so you can pipe one into the other:

marked | wkhtmltopdf - file.pdf

Problem :

The goal is to take a Markdown file and output a PDF. Using the CLI tools from marked and wkhtmltopdf, I have:

marked -o file.html && wkhtmltopdf git.html file.pdf && start file.pdf

This works but it leaves a useless HTML file to clean up. I would like to avoid this read/write step altogether. Is there a way to pipe the output from marked to wkhtmltopdf directly?

Is there a better tool to use? I’m open to JavaScript, C#, and command-line based tools.