Package: md2ebook
RequirementsCalibre(especially itscommand-line-interface tools)PandocPythonepubcheck(this one’s optional)Please note that you need eitherCalibreorPandoc(or both) to generate
EPUB files, but you need Calibre (and its CLI tools) to check the EPUB
conformity.InstallationOnce the non-python requirements are installed, you can install system-wide, or
inside a virtualenv:pip install -e ./Usageto start a new book, just create a new project with the following command:md2ebook startor, alternatively:md2ebook start directory-nameWhen you’re done, you can move to this directory and use thebuildcommand:md2ebook buildThis will build a HTML and a EPUB version of your book, as defined in thebook.jsonfile.Extra commandsYou can check your EPUB integrity using the following:md2ebook checkOptionsFor more help on the md2ebook command, simply type:md2ebook --helpand you’ll get extensive documentation about commands and their options.CoverYou can designate a cover for your ebook using one of the three options:Adding a--coverargument to the command line,Adding acoverkey to your configuration file,Leaving acover.(png|jpg|jpeg|svg)file at the root of your project, this
one will be used as a cover.If none of them leads to an existing file, the ugly default cover will be used.Please note that the configuration option or the optional argument may be a
URL (yes, something likehttp://example.com/beautiful-cover.jpg).Configuration fileAt the root of your book directory, you have abook.jsonfile which
contains your book configuration. This file is mandatory.Here are itsmandatoryoptions, as a complete example:{
    "files": ["chapter1.md", "chapter2.md", "chapter3.md"],
    "author": "Joe A. Nonymous",
    "title": "What a beautiful title",
    "fileroot": "what-a-beautiful-title",
    "generator": "calibre"
}filesis a list of markdown files that live in your book root directory.
They’ll be processed in that specific order and compiled into a single ebook.authoris the name of the author of the book.titleis the title of the book, in its full glory.filerootthis string will serve as arootfor the different outputs.
Following the example, you’ll producewhat-a-beautiful-title.htmlandwhat-a-beautiful-title.epubin your book root directory.generatoris either “calibre” or “pandoc”. Pick the one you prefer (or
the one that is available on your system).Extra configurationpdf: triggers the PDF generation when using build. Set it totrueorfalse. If not set, the PDF won’t be generated. Use the--with-pdfoption to override this settings.cover: will set the path of your cover. this must lead to an existing file
and if possible, an image (png, jpg, jpeg, or even SVG).extensions: this list of strings defines theMarkdown Extensionsyou can add to parse the Markdown files. Please refer to the Markdown
extension to use the supported extensions.Note about the Markdown extensionsHere’s a list about the available extensions:Extra (“extra”)Abbreviations: (“abbr”)Attribute list: (“attr_list”)Definition Lists:  (“def_list”)Fenced Code Blocks:  (“fenced_code”)Footnotes: (“footnotes”)Tables: (“tables”)Smart Strong: (“smart_strong”)Admonition: (“admonition”)CodeHilite: (“codehilite”)HeaderId: (“headerid”)Meta-Data: (“meta”)New Line to Break: (“nl2br”)Sane Lists: (“sane_lists”)Table of Contents: (“toc”)WikiLinks: (“wikilinks”)Here’s an example of config.json using the extensions:{
"files": [
    "book.md"
],
"title": "Les 3 Mousquetaires",
"fileroot": "les-3-mousquetaires",
"author": "Alexandre Dumas",
"extensions": ["admonitions", "toc", "footnotes"],
"generator": "pandoc"
}Extension parameters are setas described in the docs"extensions": ["headerid(level=3)"]CreditsThis piece of software is Copyleft 2013 - Bruno Bord.It is released under the terms of the MIT License, see LICENSE file for more
details.