Use a HTML parser written from scratch for IDK -> HTML conversion, check HTML structure and HTML node creation and appending.
The source code make extend use of the source code repository you can get by subscribing to this substack: rfleury.com, this is a very quick way to be able to work quickly and I learnt a ton by using it.