TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Converting Markdown to ePub or Mobi Using Pandoc

128 pointsby sks147about 4 years ago

15 comments

d_rcabout 4 years ago
Thanks for the nice tutorial OP.<p>Here&#x27;s a public notebook in Deepnote if anyone wants to play around with the code or duplicate it: <a href="https:&#x2F;&#x2F;deepnote.com&#x2F;project&#x2F;Converting-Markdown-to-Epub-or-Mobi-VpntB6TCQGOxo_ZrWY3-3w" rel="nofollow">https:&#x2F;&#x2F;deepnote.com&#x2F;project&#x2F;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&#x27;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:&#x2F;&#x2F;docs.deepnote.com&#x2F;environment&#x2F;custom-environments" rel="nofollow">https:&#x2F;&#x2F;docs.deepnote.com&#x2F;environment&#x2F;custom-environments</a><p>2. You can turn any notebook to a blogpost right away and publish within Deepnote directly.<p>Disclaimer: I&#x27;m a software engineer at Deepnote.
评论 #26900019 未加载
评论 #26900520 未加载
评论 #26900393 未加载
ggambettaabout 4 years ago
I followed a similar approach for my novel; started with Markdown, used pandoc to convert it to epub&#x2F;mobi, but also to LibreOffice .odt to generate the PDF for the paperback. Wrote some details about the process here: <a href="https:&#x2F;&#x2F;gabrielgambetta.com&#x2F;tgs-open-source.html" rel="nofollow">https:&#x2F;&#x2F;gabrielgambetta.com&#x2F;tgs-open-source.html</a>
PascalPrechtabout 4 years ago
That&#x27;s how I wrote and self-published my book as well! Although, I created a script that turns md to epub&#x2F;mobi&#x2F;pdf using pandoc.<p>Here&#x27;s how I did it in case anyone is interested: <a href="https:&#x2F;&#x2F;pascalprecht.github.io&#x2F;posts&#x2F;writing-an-ebook" rel="nofollow">https:&#x2F;&#x2F;pascalprecht.github.io&#x2F;posts&#x2F;writing-an-ebook</a>
评论 #26903888 未加载
kimiabout 4 years ago
Don&#x27;t want to be a troll, but if you are writing anything that is not a README and&#x2F;or is a book or booklet or bookish, do yourself a favor and use Asciidoc instead.
评论 #26902388 未加载
评论 #26904400 未加载
评论 #26904767 未加载
评论 #26901656 未加载
mraza007about 4 years ago
Pandoc has been one of the best tools I have used and this blogpost is well written
avinasshabout 4 years ago
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:&#x2F;&#x2F;epub.press&#x2F;#about" rel="nofollow">https:&#x2F;&#x2F;epub.press&#x2F;#about</a>
progvalabout 4 years ago
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:&#x2F;&#x2F;github.com&#x2F;jgm&#x2F;pandoc&#x2F;releases&#x2F;download&#x2F;2.11.3.2&#x2F;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:&#x2F;&#x2F;download.calibre-ebook.com&#x2F;linux-installer.sh | sudo sh &#x2F;dev&#x2F;stdin </code></pre> With simply this:<p><pre><code> !apt install pandoc calibre</code></pre>
评论 #26901976 未加载
评论 #26901477 未加载
asicspabout 4 years ago
The tutorial is presented well. My biggest takeaway was that one can use &#x27;Deepnote&#x27; to run Linux commands.<p>If you are interested in knowing how to customize `pandoc` for generating PDF&#x2F;EPUB, I have a tutorial [0] based on books I&#x27;ve written. I also have links at the end with related resources, including tools others than `pandoc`.<p>[0] <a href="https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;customizing-pandoc&#x2F;" rel="nofollow">https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;customizing-pandoc&#x2F;</a>
评论 #26900111 未加载
Finnucaneabout 4 years ago
Note that mobi format is being deprecated by Amazon. If you&#x27;re producing a file for distribution by Amazon, you only need the epub file.
评论 #26903949 未加载
alias_neoabout 4 years ago
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).
评论 #26910231 未加载
评论 #26901823 未加载
acidburnNSAabout 4 years ago
Good stuff. When I wrote an eBook I found the extra features of reStructuredText to be useful (index, glossary, graphviz &amp; Tikz environments, etc.) and wrote a sort of similar post.<p><a href="https:&#x2F;&#x2F;digitalsuperpowers.com&#x2F;blog&#x2F;2019-02-16-publishing-ebook.html" rel="nofollow">https:&#x2F;&#x2F;digitalsuperpowers.com&#x2F;blog&#x2F;2019-02-16-publishing-eb...</a>
评论 #26899414 未加载
throwanemabout 4 years ago
You know, I bet it wouldn&#x27;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&#x27;d just need pagination and formatting for print, really.<p>I&#x27;d definitely want to use such a thing, as a way to feed my bookbinding hobby. I wonder if anyone else would?
timClicksabout 4 years ago
Is the resulting typesetting any good?
评论 #26899196 未加载
评论 #26899804 未加载
nvr219about 4 years ago
Pandoc is a GOAT tool! It&#x27;s so good.
TTT1about 4 years ago
very interesting