I (djazz) created this tool as a companion to when I edit the epub in Sigil, but you can use any editor/toolchain. You can use this Makefile and create a local git repo and keep your ebook in version control.
Make sure you have the make
command and python3 with lxml installed available. You also need java
to be able to validate the ebook with EpubCheck, inotifywait
from inotify-tools and Calibre for the tools ebook-polish
and ebook-view
. Kindle export requires ImageMagick.
- Copy your epub ebook and put it next to the Makefile and rename it to
current.epub
. This is a hardcoded name that the tool uses to read the book from. - Open a terminal and run
make extractcurrent
. This will populatesrc/
with the contents of the ebook usingunzip
. Alternatively, you can runmake init
if you're making an ebook from scratch. It does not generate a valid ebook, just the basic files and folder structure. - You can now validate the ebook. Run
make validate
. It first builds the epub intobuild/
based on the contents ofsrc/
(make build
). Then it downloads EpubCheck (only first time) and runs it on the ebook. - You can open the built ebook in Calibre's viewer with
make view
. - You can export a Kindle ebook by running
make buildkindle
. This will on first run download KindleGen (Linux version only). KindleGen might output some helpful warnings on how you can improve the epub file. By default the Makefile uses KindleGen's-c1
compression, but you can change that if you want. If you prefer Calibre's ebook-convert, runmake buildazw3
. - Open up
current.epub
in your epub editor. Runmake watchcurrent
. The tool will now wait until you save the file. When you do it will run the validator on it. It's quite useful to spot errors or warnings as you edit the epub. When you're done, runmake extractcurrent
and thesrc/
directory is updated. This will overwrite everything insrc/
. - You can run
make release
to validate, build for kobo/kindle and copy them torelease/
with the current date in filename.
You're welcome to look at the Makefile to understand what it does and how it works.
You can fork and/or clone this repository and add your own ebook as current.epub
. Then run make extractcurrent
and make build
. Make it a habit to run make validate
before you publish or share the built ebook.
Create a new git repository (or fork this) and commit your book. With every new release of the book you can also tag it with either version numbers or current date. This is so you later can go back and look at the difference between revisions. The power of version control!
This is free and unencumbered software released into the public domain.