Skip to content

Instantly share code, notes, and snippets.

@danspndl
Created March 4, 2019 10:09
Show Gist options
  • Save danspndl/11cf1262d32d3279cb6c103916f505f7 to your computer and use it in GitHub Desktop.
Save danspndl/11cf1262d32d3279cb6c103916f505f7 to your computer and use it in GitHub Desktop.
Generate PDF from Markdown files before commit
#!/bin/sh
if [ ! -d "_exports/" ]; then
mkdir "_exports/"
echo "Created _exports folder"
fi
echo "Converting..."
FOLDER=./*.md
for f in $FOLDER
do
FILENAME=$(basename "$f" .md)
echo "Processing $FILENAME file..."
pandoc "$f" -o "./_exports/${FILENAME}.pdf"
done
git add _exports/
echo "Finished."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment