engl-2311-webfolio/md2html.sh
2024-11-12 09:53:36 -06:00

11 lines
472 B
Bash
Executable file

#!/usr/bin/env bash
set -e
dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
find . -name "*.md" | while read -r item; do
item="${item%.*}"
echo "Currently processing ${item}"
pandoc -f markdown-smart --data-dir . --template ${dir}/template.html -t html -o ${item}.html ${item}.md --metadata title="$(grep -m 1 -oP '(?<=^# ).*' ${item}.md | cat)"
done
find . \( ! -regex './md2html.sh' \) -type f | xargs sed -i 's/sourceCode /language-/g'