diff --git a/convert-md.sh b/convert-md.sh
index 40f9ef7..d4a6ca8 100755
--- a/convert-md.sh
+++ b/convert-md.sh
@@ -2,23 +2,14 @@
CSS=$(cat ./styles.css)
-HTML_BEGIN="
-
-
-
-
-
-
-
-
-
"
-
HTML_END="
"
cd "$(dirname "$0")"
+ROOT_DIR="$(pwd)"
+
find . -type f -name "*.md" -print0 | while IFS= read -r -d '' mdfile; do
dir=$(dirname "$mdfile")
base=$(basename "$mdfile" .md)
@@ -34,6 +25,37 @@ find . -type f -name "*.md" -print0 | while IFS= read -r -d '' mdfile; do
pandoc "$mdfile" -t html -o "$html_raw"
+ abs_dir="$(cd "$dir" && pwd)"
+ rel_depth="${abs_dir#$ROOT_DIR}"
+ rel_depth="${rel_depth#/}"
+
+ nav=""
+ if [[ -z "$rel_depth" ]]; then
+ if [[ "$out_base" != "index" ]]; then
+ nav=''
+ fi
+ else
+ if [[ "$out_base" == "index" ]]; then
+ nav=''
+ else
+ nav=''
+ fi
+ fi
+
+ if [[ -n "$nav" ]]; then
+ nav="$nav
"
+ fi
+
+ HTML_BEGIN="
+
+
+
+
+
+
+
+ $nav"
+
{
echo "$HTML_BEGIN"
sed -E 's/href="(\.\/[^.]+)"/href="\1\/"/g' "$html_raw" | \