#!/usr/bin/env bash set -e while true; do dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) pandoc -f markdown-smart --data-dir . --template ${dir}/template.html -t html -o $dir/tmp.html $dir/index.md --metadata title="$(grep -m 1 -oP '(?<=^# ).*' $dir/index.md | cat)" sed -i "s/output here/$(sed 's/\//\\\//g' $dir/../output)/g" $dir/tmp.html sed "s/sourceCode /language-/g" $dir/tmp.html > $dir/index.html rm -f $dir/tmp.html sleep 1 done