Open alvinj opened 4 years ago
I’m getting back into this process this weekend, and I just want to note that the main part of the ePub process is running this command after making some slight tweaks to the Markdown files:
pandoc -o ScalaBook.epub \
metadata.txt \
introduction.md \
prelude-taste-of-scala.md \
preliminaries.md \
... many more markdown filenames here ...
For that command, the metadata.txt file looks like this:
---
title: Scala Book
author: Alvin Alexander, et al
rights: Creative Commons Non-Commercial Share Alike 3.0
language: en-US
---
You can add more information to that file, as well as a stylesheet, as described in this medium.com article.
That pandoc
command currently has a problem with Markdown tables, which is what I’ll work on next. But once you have a working ePub file, you can then create a MOBI file with this command:
kindlegen ScalaBook.epub
The PDF-generating process is much more involved, but this process is pretty simple.
I put the initial tools for creating EPUB and MOBI versions here:
I don’t know how to get the website’s markdown files into the proper directory, but that should be a simple configuration change.
I’ll work on the PDF process next.
Any update on this? I'd love to read "A Taste of Scala 3" as a PDF on my remarkable. Right now this chapter is split in many sections (I can do "print" from Chrome for each section but it's a bit annoying; I'd rather have a nice clean PDF of the whole chapter, of even better of the whole book).
Note that it was less a problem for the Scala 2 book because "A Taste of Scala" was a single file: https://docs.scala-lang.org/overviews/scala-book/prelude-taste-of-scala.html so it was easy to print from Chrome as a PDF.
Any update on this?
Technically I can generate PDF and MOBI versions pretty quickly. I think we were just waiting to have the book reviewed to get it in better shape. Then I just need to take out the time to remember the process. :)
This is the start of some notes on how to automatically create PDF, ePub, and MOBI versions of Scala Book. I have already generated first versions of these documents with a manual process (excluding a couple of problems noted below), and this is a writeup of how to automate the process.
To create an ePub document
#
title tag to each *.md file<pre>
sections to use only four backticksI have code to do all of that, I just need some free time to clean it up and automate it.
To create a MOBI document
There are more elaborate ways to do this, but at the moment this command seems to work, generating the MOBI document from the ePub:
It looks like KindleGen is available for Linux, MacOS, and Windows:
To create a PDF document
I currently have a way to do this, but it will take a little time to automate. The first few steps in the process are similar to the ePub process, but you don’t need to add a chapter number:
#
title tag to each *.md file<pre>
sections to use only four backticksAfter that the steps are:
latexmk
commandKnown problems
Generating the PDF
I haven’t had the time to look into that yet.
Generating the ePub document
{::comment}
syntax shows up in the MOBI document, so it’s probably also in the ePubTools
So far my “tools” for generating these documents are:
sed
commands#
title tags to the resulting Markdown filesWhat I need
Mostly all I need to complete this process is some free time on my part, and then I just need to know that the tools listed will be available on the server. Assuming I can work through the problems listed, the whole process is really:
latexmk
commandpandoc
commandkindlegen
commandI think the ePub and MOBI files can also use a stylesheet, so that’s something else to be looked into, but I’m more concerned about automating these processes at the moment.