diff options
Diffstat (limited to 'markdown-to-pdf')
-rwxr-xr-x | markdown-to-pdf | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/markdown-to-pdf b/markdown-to-pdf new file mode 100755 index 0000000..732a456 --- /dev/null +++ b/markdown-to-pdf @@ -0,0 +1,44 @@ +#!/bin/sh + +set -e + +book_prelude() +{ + cat <<eof +<html> +<head> +<title>Book</title> +<link rel="stylesheet" href="book.css" type="text/css" /> +</head> +<body> +eof +} + +book_end() +{ + cat <<eof +</body> +</html> +eof +} + +chapter() +{ + cat <<eof +<div class="chapter"> +eof + + markdown "$1" + + cat <<eof +</div> +eof +} + +(book_prelude +for f in "$@" +do + chapter "$f" +done +book_end) > book.html +wkhtmltopdf book.html book.pdf |