#!/usr/bin/env python3 """ reformat_parse.py — Parse a markdown / text / PDF / HTML source into a self-contained .html file ready for `render_html.cjs`. Input formats (auto-detected by extension): .md / .markdown — Markdown (markdown-it-py with GFM table + strikethrough) .txt — Plain text (treated as a sequence of paragraphs) .pdf — pdftotext -layout (requires poppler) → markdown-ish .html / .htm — Pass-through body extraction (…) Output: a single HTML file (templates/