Try Documentalist, my app that offers fast, offline access to 190+ programmer API docs.
I already had HTML renderer.
In first step, I re-used the structure of HTML renderer and implemented markdown rendering instead.
I also found ways to improve (simplify) the renderer, so I did that as a second pass
I'll make the same improvements to HTML renderer.
I'm confident in the code because I've tested it against pretty complicated pages from Notion and their own export.
I've built a system where I use Notion's Markdown export to generate "golden" file and then compare results of my converter to Notion's export.
I even found corner-case bugs in Notion's exporter.
Next up I want to re-write HTML renderer to produce the same (or at least very similar) result to Notion's export.