#!/usr/bin/env bash
set -euo pipefail
CMD="${1:-help}"; shift 2>/dev/null || true
case "$CMD" in
help) echo "Remark — HTML slideshow from Markdown
Commands:
generate
preview
theme
speaker
info Version info
Powered by BytesAgain | bytesagain.com";;
generate)
f="${1:-}"; [ -z "$f" ] && { echo "Usage: generate
out="${f%.md}.html"
python3 << PYEOF
with open("$f") as fh: md = fh.read()
html = """
body{font-family:sans-serif;margin:0}
.slide{min-height:100vh;padding:60px;display:flex;flex-direction:column;justify-content:center;border-bottom:1px solid #eee}
h1{font-size:2.5em;color:#333}h2{font-size:2em;color:#555}
li{font-size:1.3em;margin:8px 0}
pre{background:#f5f5f5;padding:15px;border-radius:5px}
.footer{text-align:center;color:#999;padding:20px}
"""
slides = md.split("
")
for i, slide in enumerate(slides):
content = slide.strip()
if not content: continue
html += '
for line in content.split("\\n"):
line = line.strip()
if line.startswith("# "): html += "
elif line.startswith("## "): html += "
elif line.startswith("### "): html += "
elif line.startswith("- "): html += "
elif line: html += "
{}
".format(line)html += "
html += '
with open("$out", "w") as fh: fh.write(html)
print("Generated: $out ({} slides)".format(len(slides)))
PYEOF
;;
preview)
f="${1:-}"; [ -z "$f" ] && { echo "Usage: preview
bash "$0" generate "$f"
out="${f%.md}.html"
echo "Open in browser: file://$(readlink -f "$out" 2>/dev/null || echo "$out")";;
theme)
name="${1:-dark}"
case "$name" in
dark) echo "background:#1a1a2e;color:#eee;h1{color:#e94560}";;
light) echo "background:#fff;color:#333;h1{color:#0f3460}";;
solarized) echo "background:#002b36;color:#839496;h1{color:#b58900}";;
*) echo "Themes: dark, light, solarized";;
esac;;
speaker)
f="${1:-}"; [ -z "$f" ] && { echo "Usage: speaker
echo "Add speaker notes with ???:"
echo " ## Slide Title"
echo " Content here"
echo " ???"
echo " Speaker notes go here";;
info) echo "Remark v1.0.0"; echo "Inspired by: gnab/remark (12,000+ stars)"; echo "Powered by BytesAgain | bytesagain.com";;
*) echo "Unknown: $CMD"; exit 1;;
esac