Skip to content

Instantly share code, notes, and snippets.

@jb55
Last active November 25, 2019 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jb55/0a953cc7be08978698a0f581deeff889 to your computer and use it in GitHub Desktop.
Save jb55/0a953cc7be08978698a0f581deeff889 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
PANDOC="pandoc --variable urlcolor=cyan"
usage () {
printf "usage: pdfnow file.md OR <file.md pdfnow markdown\n" >&2
exit 1
}
[ $# -eq 0 ] && usage
if [ -t 0 ]; then
[ $# -eq 0 ] && usage
$PANDOC "$1" -o /tmp/out.pdf
else
[ $# -eq 0 ] && usage
ext="$1"
$PANDOC -f "$ext" -o /tmp/out.pdf
fi
zathura /tmp/out.pdf &>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment