Skip to content

Instantly share code, notes, and snippets.

@plaindocs
Last active September 5, 2019 05:22
Show Gist options
  • Save plaindocs/f52355ee7d10327ba839 to your computer and use it in GitHub Desktop.
Save plaindocs/f52355ee7d10327ba839 to your computer and use it in GitHub Desktop.
PDF from markdown

Dependencies

Instructions are for Ubuntu ish:

sudo apt-get install -y python-dev python-pip python-lxml libcairo2 libpango1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
sudo pip install WeasyPrint
sudo pip install markdown

For other systems check

Print

for i in docs/*.md
do 
     file=`basename $i .md`	
     markdown_py -x toc -x tables docs/$file.md > output/$file.html
     weasyprint output/$file.html output/$file.pdf -s CSS21-print.css
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment