#!/bin/sh
#
# markdown - converts markdown(7) input into HTML using GitHub README styling
#
# ---
# see: https://github.com/sunaku

# shellcheck disable=SC2312

cat <<HTML
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>$*</title>
  </head>
  <body class="container readme">
    <article class="markdown-body">$(cmark-gfm -e table -e autolink "$@")</article>
    <style>$(
      test -s "$0.css" || wget -O "$0.css" -N \
        https://github.com/sindresorhus/github-markdown-css/raw/main/github-markdown.css
      cat "$0.css"*
    )</style>
  </body>
</html>
HTML
