I have a couple bash scripts that I use to call pandoc to generate PDFs, HTML, or ePub.
Here is the repo https://gitlab.com/pianomanfrazier/pandoc-markdown-book and here is my blog post https://pianomanfrazier.com/post/write-a-book-with-markdown/