Pandoc[1] is the tool you need. Extremely simple to use, even more if you start with posts written in markdown, and you can generate any format known to man.
I dont know how much of this you want to do yourself, but i would copy the text into a docx file and convert that to mobi using e.g. calibre. Or are you looking to automate it? I'd probably use a python library for making epubs in that case.
I remember someone launching pg2epub.com here on HN. Maybe reach out to the guy who did it and see if he is willing to give out the code? I clip all of the good articles to Evernote (via their web-clipper) maybe you can do the same and then export it out to PDF. Hope this helps!
[1] https://pandoc.org/