Skip to content

Instantly share code, notes, and snippets.

@angrykoala
Last active July 11, 2017 10:16
Show Gist options
  • Save angrykoala/86c8c1dd06db5cacc34c to your computer and use it in GitHub Desktop.
Save angrykoala/86c8c1dd06db5cacc34c to your computer and use it in GitHub Desktop.
small flavored markdown converter to pdf using pandoc
#!/bin/bash
#md2pdf: small flavored markdown converter to pdf using pandoc
#by @angrykoala
if [ $# -eq 0 ]
then echo "Need at least one argument md2pdf [files]";
else
for var in "$@"
do
filename=$(basename "$var")
extension="${filename##*.}"
filename="${filename%.*}"
#add --toc to create a table of contents
pandoc $var -f markdown_github -o $filename.pdf -V geometry:margin=1in -V fontsize=12pt
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment