mark2epub is a simple Python script for converting Markdown files, images, and css files to a single ePub book.
mark2epub requires:
- Python (>= 3.4)
- markdown (>= 3.1)
The syntax for mark2epub is the following:
$ python md2epub.py <markdown_directory> <output_file.epub>
The directory epub_md is a sample markdown directory for mark2epub.
Note that the directory markdown_directory must contain
-
Markdown
.mdfiles. Each file represent a chapter in the resulting ePub. They are processed by name order, and will appear correspondingly in the e-book. -
An
imagesfolder, containing the images to be included. Only GIF (.gifextension), JPEG (.jpgor.jpegextensions), and PNG (.pngextension) files are currently supported. This folder is not processed recursively, so all images should be placed at the root of this folder. -
A
cssfolder, containing the CSS files. This folder is not processed recursively, so all css files should be placed at the root of this folder. -
A
description.jsoncontaining meta-information about the e-book. The keycover_imageshould indicate the name of the cover image. The keydefault_cssis a list of css file names that are applied by default on all chapters. The keychaptersis a list of dictionaries, each one containing a keymarkdownindicating the name of the corresponding markdown file, and a keycssindicating the name of the css file that should be applied specifically to this chapter. See the example in the repository for a typicaldescription.jsonfile.
- Robustness checks in the
mark2epub.pyscript - Recursive processing of the
imagesandcssfolders - Support for additional fonts
- Support for mathematical notation