askiiart-net/md2html.sh

11 lines
434 B
Bash
Raw Normal View History

2023-10-09 10:31:24 -05:00
#!/usr/bin/env bash
2023-09-11 20:10:21 -05:00
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)"
2023-11-20 11:08:03 -06:00
sed -i s/sourceCode\ /language-/g ${item}.html
2023-09-11 20:10:21 -05:00
done