POSIX shell script for creating a minimal EPUB from a small collection of files

4a5b934 Save user-provided data by default, add -i option.

7 months ago

c44ddcb Add option to include cover page.

7 months ago

EPUB-CREATE(1) - General Commands Manual


epub-create - simple shell script for creating EPUB documents


epub-create [-i] [-o cover] dir


epub-create is a simple POSIX shell script for creating an EPUB document from a directory containing non-binary files.

When run on a directory for the first time, epub-create will ask for the document title, authors, language and publication ID. Pressing ENTER at any prompt will result in a default value being used; the defaults are "A Document", "[unknown]", "en" and "[unknown]", respectively.

The values are then saved in dir/.conf, which will provide their values for future runs, unless the -i option is specified.

epub-create will then start EDITOR with a list of the files found in dir. This is the EPUB 'spine', via which one specifies the order in which the reader of the EPUB should read the files.

Upon save and exit, epub-create will open each file in the reading order specified, allowing one to finalise the contents of the XHTML version of each file. At a minimum, this should involve changing the contents of the <title> element, but this is not required.

Once all the files have been processed, epub-create will open the nav.xhtml file containing the table of contents, for finalising. Upon save and exit, a file named 'dir.epub' will be created in the current directory.


This script is intended to be runnable via a POSIX-compliant shell, requiring only the presence of cat(1p), date(1p) and zip(1).



Interactive: ask user for title, author, etc. even if already specified in dir/.conf.

-o cover

Generate a cover page with document title and author(s).



The editor to use for editing.


EPUB 3 Overview


EPUB Open Container Format (OCF) 3.2


EPUB Packages 3.2


EPUB 3 Structural Semantics Vocabulary 1.1





Alexis flexibeast@gmail.com


epub-create is not intended to be anything other than a portable, low-dependency script for creating a minimal EPUB from a small collection of files. There are no plans for it to develop further capabilities and become a serious tool for working with EPUBs.

One cross-platform option for serious EPUB work is Sigil, based on QtWebEngine:


For simply creating an EPUB from an existing document in formats such PDF or OOXML, consider Pandoc:


README generated from epub-create.1 mdoc(7) source with mandoc(1).