This is a Python script to convert Apple’s developer documentation to the Kindle’s mobipocket format, including table of contents and chapter markers.
- The kindlegen commandline tool has to be downloaded separately from Amazon.
- Docsets can be downloaded with Xcode. The Mac OS X documentation set is typically located in /Developer/Documentation/DocSets, e.g. /Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset. The iOS documentation is usually in /Library/Developer/Documentation/DocSets.
- Place the kindlegen binary in the script’s directory or somewhere in your $PATH.
> python docset2kindle.py "path/to/docset" -o output_directory
- This will extract all documents of type ‘Guide’ or ‘Getting Started’ from the specified docset and put Kindle versions in the output directory (documentation for individual classes etc. is not included). The conversion may take a couple of minutes. The docset for iOS contains about 140 books, the one for Mac OS X about 340.
> python docset2kindle.py "path/to/docset" -o output_directory -f epub
- This will convert all document to EPUB format.
- It’s also possible to specify a directory that contains multiple docsets (e.g. /Developer/Documentation/DocSets), but as the output file names are determined by the book titles, it is possible that a book in one of the docsets overwrites a book with the same title in another docset.
- Lists (ul, ol) don’t look quite right (there’s too much vertical space after the bullet point)
- Links across books don’t work (I’m not sure if this is even possible with Kindle books)
- Newest Apple docsets not supported. Newest supported docsets are:
- iOS 4.3 Library
- Snow Leopard Library (install from XCode)