diff --git a/st.sh b/st.sh
index e08ff73..cf35db2 100644
--- a/st.sh
+++ b/st.sh
@@ -1,11 +1,20 @@
-input=.
-output=./out
+input=$1
+output=$input/out
outformat=markdown+hard_line_breaks+autolink_bare_uris+lists_without_preceding_blankline
+index=$output/index.html
+
rm -rf $output/*
cp style.css $output/style.css
+echo '
' >> $index
+
for f in $input/*.md
do
f=${f##*/}
- sed 's/\[\[\(.*\)\]\]/\[\1\](\1.html)/g' "$input/$f" | pandoc -f $outformat --metadata title="${f%.md}" --standalone --css=style.css -o "$output/${f%.md}.html"
-done
\ No newline at end of file
+ title=${f%.md}
+
+ sed 's/\[\[\(.*\)\]\]/\[\1\](\1.html)/g' "$input/$f" | pandoc -f $outformat --metadata title="$title" --template template.html --standalone -o "$output/${title}.html"
+ echo "" >> $index
+done
+
+echo '' >> $index
diff --git a/style.css b/style.css
index d66d15d..cf65a69 100644
--- a/style.css
+++ b/style.css
@@ -1,3 +1,3 @@
-body {
- font-family: helvetica
-}
\ No newline at end of file
+body {
+ font-family: helvetica
+}
diff --git a/template.html b/template.html
new file mode 100644
index 0000000..cf2e2fb
--- /dev/null
+++ b/template.html
@@ -0,0 +1,15 @@
+
+
+
+
+ $title$
+
+
+
+
+
+$body$
+
+