Auto Generating and Printing PDF Files From Markdown? I'm looking for a way to automatically have my computer generate and print PDF files from a folder full of markdown files.  

So, every morning at 5AM I'd want my computer look at my /markdown-files folder, create a bunch of PDFs to go into a /PDF-folder and also run the printer so the pages are waiting for me.  

There are a couple of requirements that might make this a bit tricky:


The PDFs should have the file title at the top of each page
The page needs to be A4
The lines should be double spaced at least.


I used to use WKPDF to generate PDFs, but it no longer works on Yosemite.
You can do this with Markdown.pl and htmldoc(1), both of which can be installed with Homebrew.  The basic flow for making a PDF is:

markdown foo.markdown | htmldoc --no-toc --no-title -f foo.pdf -


As for your filename-per-page, you coul incorporate echo to add it as an HTML element:

echo $(markdown foo.markdown) "&lt;p&gt;foo&lt;/p&gt;" | htmldoc --no-toc --no-title -f foo.pdf -


And for printing, the lpr(1) command will send a file to your default printer.

Tying this altogether:

for filename in `ls *.markdown`;
do
    echo $(markdown "$filename") "&lt;p&gt;$filename&lt;/p&gt;" | 
        htmldoc --no-toc --no-title -f "${filename}.pdf" -
    lpr "${filename}.pdf"
done