#!/bin/bash
# Render a markdown file to HTML, as a preview.
set -e
INPUT="${1:-README.md}"
OUTPUT="${2:-/tmp/output.html}"
if [ ! -f "${INPUT}" ]; then
echo "You need to specify an input file" 1>&2
exit 1
fi
[ -e "${OUTPUT}" ] && rm "${OUTPUT}"
pandoc -f markdown_github -c https://goo.gl/OVmlwT --self-contained -o "${OUTPUT}" "${INPUT}"
if [ -e "${OUTPUT}" ]; then
open "${OUTPUT}"
else
echo "Failed."
exit 1
fi