This gist has a Python script I created to convert my book, Zefs Guide to Deep Learning from Markua 0.10 in LaTeX. It works, but maybe not for you. But maybe if you mess with it, it can suit your needs.
I wrote my book in Leanpub's Markua 0.10 markup language and am publishing the ebook there, but I decided that I wanted to publish a paperback in a smaller size via Amazon's Kindle Direct Publishing. Unfortunately, none of the smaller print sizes that Leanpub supports are the same as the smaller print sizes that KDP will print, so in order to create a "pocket-sized" book, I needed to generate my own PDF file.
The most recommended way to do this is via pandoc. Unfortunately, pandoc does not support converting from Markua to LaTeX (although they supposedly support the other direction). While pandoc does support markdown to LaTeX, I found that there were