blob: 3ed9482e54e1cf7b99e92807f6c08cee2732fbaf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/bin/bash
set -euo pipefail
if [ $# -eq 0 ]
then
exec find . -name \*.md -exec "$0" {} +
fi
for file
do
if ! [ -f "$file" ]
then
echo >&2 "File not found: $file"
continue
fi
echo "$file"
{
title=$(sed '/^# / { s/# //; q }' "$file")
sed "s/__TITLE__/$title/" prelude.html
echo "<body>"
markdown2 "$file" -x fenced-code-blocks,highlightjs-lang,tables
echo "</body>"
} > "${file%.md}".html
done
|