Skip to content

Instantly share code, notes, and snippets.

@ylmrx
Created November 20, 2019 18:45
Show Gist options
  • Save ylmrx/48403eb6dc934c6414d8a3e959279f9b to your computer and use it in GitHub Desktop.
Save ylmrx/48403eb6dc934c6414d8a3e959279f9b to your computer and use it in GitHub Desktop.
Monitor .md, update .pdf
function pandonitor {
if [[ -f $1 ]]; then
while true; do
inotifywait -qq -e modify $1
if [[ $2 == 'slides_owl' ]]; then
pandoc ${@:3} -t beamer -V theme:owl -o /tmp/pandonitor.pdf $1
elif [[ $2 == 'slides_metro' ]]; then
pandoc ${@:3} -t beamer -V theme:metropolis -o /tmp/pandonitor.pdf $1
elif [[ $2 == 'eis' ]]; then
pandoc ${@:3} --pdf-engine=xelatex --template eisvogel -o /tmp/pandonitor.pdf $1 --listings\
--highlight-style pygments -V titlepage=true -V toc-own-page=true --toc
fi
done
else
echo 'Give me a file to monitor'
echo '2nd arg: [slides_owl|slides_metro|eis]'
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment