I recently found a way to use markdown to create a document and then convert it to a PDF document. There are many online options to do that but I used a VS Code extension to do that.
Markdown PDF – Visual Studio Marketplace
It is nice and converts the markdown file properly into a PDF document with the images into it.