Skip to content

Instantly share code, notes, and snippets.

@anabarasan
Forked from M1ke/README.md
Created November 26, 2018 05:29
Show Gist options
  • Save anabarasan/8bde49072956a8d14e48f408c11be481 to your computer and use it in GitHub Desktop.
Save anabarasan/8bde49072956a8d14e48f408c11be481 to your computer and use it in GitHub Desktop.
Quickly convert a markdown file into a nice looking PDF formatted in the same way GitHub formats Readme.md files

Markdown to PDF

Quickly convert a markdown file into a nice looking PDF formatted in the same way GitHub formats Readme.md files

  • Install grip $ pip install grip
  • Install wkhtmltopdf $ sudo apt-get install wkhtmltopdf
#!/bin/bash
# Install grip $ pip install grip
# Install wkhtmltopdf $ sudo apt-get install wkhtmltopdf
md=$1
pdf=$2
port=$(( ( RANDOM % 6000 ) + 5000 ))
echo $port
grip $md localhost:$port &
sleep 10
wkhtmltopdf http://localhost:$port $pdf
kill $(ps -eo pid,command | grep "grip" | grep -v grep | awk '{print $1}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment