Skip to content

Instantly share code, notes, and snippets.

@marekkowalczyk
Created April 2, 2021 12:45
Show Gist options
  • Save marekkowalczyk/1e2b3062704f6afd5a98d39895798cdc to your computer and use it in GitHub Desktop.
Save marekkowalczyk/1e2b3062704f6afd5a98d39895798cdc to your computer and use it in GitHub Desktop.
Convert markdown to pdf with same filename and open the pdf
#!/usr/bin/env bash
# Convert markdown to pdf with same filename and open the pdf
for file in "$@"; do
filename="${file%.*}"
extension="${file##*.}"
echo "$file" "->" "$filename".pdf
pandoc -f markdown -t pdf -o "$filename".pdf "$file"
open "$filename".pdf
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment