A convenient way of publishing Markdown and CSS to a PDF using WebKit as the printer. Huge shout-out to Jakob Truelsen and the fine people at wkhtmltopdf for making this possible.
- Add Markdown.pl to your PATH.
- Add wkhtmltopdf to your PATH.
- Add Mark.rb to your PATH.
-
Markdown => html
Marx.rb in.mdown out.html
-
Markdown => pdf
Marx.rb in.mdown out.pdf
-
Markdown + CSS => pdf
Marx.rb in.mdown out.pdf -s style.css
-
Override file extension inference
Marx.rb in.mdown out -f html
Any arguments that Marx.rb doesn't recognize are passed to wkhtmltopdf. To see all of the options wkhtmltopdf supports, run:
wkhtmltopdf -H
For convenience, here are some useful ones:
-g, --grayscale PDF will be generated in grayscale
-l, --lowquality Generates lower quality pdf/ps. Useful to
shrink the result document space
-O, --orientation <orientation> Set orientation to Landscape or Portrait
(default Portrait)
-s, --page-size <Size> Set paper size to: A4, Letter, etc.
--title <text> The title of the generated pdf file (The
title of the first document is used if not
specified)
-B, --margin-bottom <unitreal> Set the page bottom margin (default 10mm)
-L, --margin-left <unitreal> Set the page left margin (default 10mm)
-R, --margin-right <unitreal> Set the page right margin (default 10mm)
-T, --margin-top <unitreal> Set the page top margin (default 10mm)
--background Do print background (default)
--no-background Do not print background
--images Do load or print images (default)
--no-images Do not load or print images
--zoom <float> Use this zoom factor (default 1)