Well, I built my static website generator out of Bottle - a single-file HTTP framework that has built-in templating. Bolting on a route that renders Markdown files is pretty simple, really, and a simple os.path.walk() and directly calling the routed function will let you do everything you need.
So you only really need bottle and markdown in your requirements.txt, and around 100ish lines of code. Maybe a little more if you want to upload the results to Cloudflare directly (for which I’d use requests).
You can rinse and repeat that with aiohttp and markdown if you want the async flavor (which is what I’d do these days if I hadn’t already “finished” mine).
And, if you’re into LISP… https://github.com/rcarmo/sushy might make for some fun reading.