#!/bin/bash -eu filepath=$1 filename=$(basename ${filepath}) output=$2 output="${output/.html.markdown}.html" printf "${filepath}\r" mkdir -p $(dirname ${output}) [ -s $output ] && exit 0 < $filepath awk '$1 == "page_title:"{$1="title:"} 1' | pandoc -f markdown -t html5 -s > $output