Patch Sphinx code to enable kindle/mobi support
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Patch Sphinx code to enable kindle/mobi support.


I assume that you'll be able to download Sphinx-1.1.3 release as well as install on your system kindlegen. The former is provided here, while later can be found on Amazon Kindle support page.


This is a fork for Sphinx 1.1.3 code with changes to enable support for Kindle (mobi data format). Basically I copied epub, tweak themes, core code and add mobi option into sphinx-quickstart.


To install, please get and patch your vanila Sphinx-1.1.3 code base with the following command:

cd Sphinx-1.1.3
patch -p1 <
cp sphinx/themes/basic/static/file.png sphinx/themes/mobi/static/file.png
cp kindle-logo.jpg sphinx/themes/mobi/static/

Then build and install your Sphinx in a usual way

python install --prefix=<your_install_path>

Build your mobi

Once everything in place, run sphinx-quickstart in a usual way, and answer y to the following questions:

  • Do you want to use the kindle/mobi builder (y/N) [n]: y
  • pngmath: include math, rendered as PNG images (y/N) [n]: y

The former enable mobi option in generated Makefile, while later allows you to embed LaTeX formulas into your mobi book.


You can find the source code as well as generated file in example directory.


Once time permit I'll look further in customization of mobi builder in sphinx code. Upon that time, I'm happy with this preliminary hack.


Most of this work was inspired and based on materials presented in this blog.