blob: df78d25dbaa2a5046513aa95eae009788e91e690 (
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
26
27
28
29
30
|
#!/bin/bash
set -euo pipefail
md2ht() {
src=$1
dst=$2
if ! [ -f "$src" ]
then
echo >&2 "File not found: $src"
continue
fi
echo "$src -> $dst"
{
title=$(sed 's/# //; q' "$src")
sed "s/__TITLE__/$title/" prelude.html
echo "<body>"
markdown2 "$src" -x fenced-code-blocks,highlightjs-lang,tables
echo "</body>"
} > "$dst"
}
md2ht index.md index.html
for note in ../notes/*.md
do
name=${note#../notes/}
name=${name%.md}
md2ht "$note" "notes/$name.html"
done
|