Thanks for the nice tutorial OP.<p>Here's a public notebook in Deepnote if anyone wants to play around with the code or duplicate it: <a href="https://deepnote.com/project/Converting-Markdown-to-Epub-or-Mobi-VpntB6TCQGOxo_ZrWY3-3w" rel="nofollow">https://deepnote.com/project/Converting-Markdown-to-Epub-or-...</a><p>2 fun facts about Deepnote:<p>1. You can create a Custom environment by writing a Dockerfile with all the libraries you need to install and everytime you're in a need to re-use a similar functionality (e.g. convert yet another book to mobi), you can just fire it up and all will be preinstalled.
<a href="https://docs.deepnote.com/environment/custom-environments" rel="nofollow">https://docs.deepnote.com/environment/custom-environments</a><p>2. You can turn any notebook to a blogpost right away and publish within Deepnote directly.<p>Disclaimer: I'm a software engineer at Deepnote.
I followed a similar approach for my novel; started with Markdown, used pandoc to convert it to epub/mobi, but also to LibreOffice .odt to generate the PDF for the paperback. Wrote some details about the process here: <a href="https://gabrielgambetta.com/tgs-open-source.html" rel="nofollow">https://gabrielgambetta.com/tgs-open-source.html</a>
That's how I wrote and self-published my book as well!
Although, I created a script that turns md to epub/mobi/pdf using pandoc.<p>Here's how I did it in case anyone is interested: <a href="https://pascalprecht.github.io/posts/writing-an-ebook" rel="nofollow">https://pascalprecht.github.io/posts/writing-an-ebook</a>
Don't want to be a troll, but if you are writing anything that is not a README and/or is a book or booklet or bookish, do yourself a favor and use Asciidoc instead.
This is a nice tutorial, thanks for submitting it! However, for me, the biggest discovery was epub.press [0]. I just tried for couple of open pages, it works quite well!<p>[0] - <a href="https://epub.press/#about" rel="nofollow">https://epub.press/#about</a>
Why wget|dpkg and wget|sh instead of apt to download Pandoc and Calibre?<p>You should be able to replace all this:<p><pre><code> !wget https://github.com/jgm/pandoc/releases/download/2.11.3.2/pandoc-2.11.3.2-1-amd64.deb
!sudo dpkg -i pandoc-2.11.3.2-1-amd64.deb
!apt install libgl1-mesa-glx -y
!wget -q -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin
</code></pre>
With simply this:<p><pre><code> !apt install pandoc calibre</code></pre>
The tutorial is presented well. My biggest takeaway was that one can use 'Deepnote' to run Linux commands.<p>If you are interested in knowing how to customize `pandoc` for generating PDF/EPUB, I have a tutorial [0] based on books I've written. I also have links at the end with related resources, including tools others than `pandoc`.<p>[0] <a href="https://learnbyexample.github.io/customizing-pandoc/" rel="nofollow">https://learnbyexample.github.io/customizing-pandoc/</a>
Is Pandoc being used mostly to join the files?<p>I recently started converting Markdown files to epub (and kepub) for my new Kobo. I load the Markdown straight into Calibre though.<p>On a side note, is there some benefit to mobi over epub? Kepub seems to be the preferred format on Kobo, because for some reason it turns pages _much_ faster than epub and gives access to reader statistics (if one cares about that).
Good stuff. When I wrote an eBook I found the extra features of reStructuredText to be useful (index, glossary, graphviz & Tikz environments, etc.) and wrote a sort of similar post.<p><a href="https://digitalsuperpowers.com/blog/2019-02-16-publishing-ebook.html" rel="nofollow">https://digitalsuperpowers.com/blog/2019-02-16-publishing-eb...</a>
You know, I bet it wouldn't take <i>that</i> much to go from epub to PDF, suitable for printing and binding. The structural information is pretty much all there, I think - it'd just need pagination and formatting for print, really.<p>I'd definitely want to use such a thing, as a way to feed my bookbinding hobby. I wonder if anyone else would?