markdown-pdf icon indicating copy to clipboard operation
markdown-pdf copied to clipboard

STDIN support in CLI interface

Open DurandA opened this issue 7 years ago • 2 comments

I think it would be a nice addition to support standard input in CLI as an easy way to automate PDF generation with shell scripts. Would it be easy to implement?

DurandA avatar Aug 30 '16 09:08 DurandA

Should be, the markdown-pdf module is a through stream so you should be able to pipe in and out:

process.stdin.pipe(markdownpdf()).pipe(process.stdout)

I'd definitely accept a pull request to the CLI that implements this!

echo "# Some markdown\nYay" | markdown-pdf

alanshaw avatar Aug 30 '16 09:08 alanshaw

Zshell workaround:

markdown-pdf -o output.pdf <(echo "# Some markdown\nYay")

It's not stdin, but it does stream and doesn't hit disk.

anko avatar Jul 26 '17 23:07 anko