#!/usr/bin/env python3 """Render a release-notes Markdown file into a small standalone HTML fragment suitable for inlining into a Sparkle appcast `` element (CDATA-wrapped). Stdlib only — no `markdown` package dependency. Covers the subset of GitHub-flavored markdown that `releases/v*/RELEASE_NOTES.md` uses: * `## Heading 2` / `### Heading 3` * paragraphs (blank-line-separated) * unordered lists (`- item`, single level only) * fenced code blocks (` ``` `) * inline `code`, **bold**, *italic*, `[link text](url)` * horizontal rules (`---`) Sparkle's `SUUserUpdateAlertController` renders the inline HTML in a WebKit view with no styling beyond what's in the body, so a tiny `\n{body}\n" def main(argv: list[str]) -> int: if len(argv) != 2: sys.stderr.write("usage: render-release-notes.py \n") return 2 path = Path(argv[1]) if not path.exists(): sys.stderr.write(f"file not found: {path}\n") return 1 sys.stdout.write(render_document(path.read_text(encoding="utf-8"))) return 0 if __name__ == "__main__": raise SystemExit(main(sys.argv))