I am a software developer and have added a MOBI export feature to one of my applications. This has worked well so far, but I'm wanting to add an index at the beginning so the document will be easier to navigate.

I am doing all of the coding myself, and am not relying on external tools like Kindlegen, Mobicreator, or Calibre. So I am hoping someone here has low level knowledge of the MOBI file format.

I am attaching a sample file (recipes.mobi) that I have exported from my application. The index shows up, but the links don't do anything when you click them?

I am also attaching the source (recipes.htm) document. This uses simple HTML linking such as

Code:

<a href="#recipe1">Recipe 1</a>

in the index and

Code:

<a id="recipe1" />

at the start of each section.

The links work fine in the HTM source (in a web browser).

If I use KindleGen to encode the Recipes.htm source, the links do work correctly. But if I use Unkindle in Calibre to unpack the MOBI file, the HTM doesn't look much different than my original source. I'm clearly missing something in the MOBI encoding.

Hi,
Kindle mobi is a compiled format. It is not like other formats. It takes significant work and preprocessing to actually properly create a mobi.

KindleUnpack does its best to decompile the format back into something that can be passed back into Kindlegen. If you use KindleUnpack you need to ask for the raw text to be dumped as well (it is a command line option). That raw text will give you an idea of how the compilation step is done in part. Note mobi 7 and mobi 8 versions handle links differently.

KevinH

Quote:

Originally Posted by mountainsoft

I am a software developer and have added a MOBI export feature to one of my applications. This has worked well so far, but I'm wanting to add an index at the beginning so the document will be easier to navigate.

I am doing all of the coding myself, and am not relying on external tools like Kindlegen, Mobicreator, or Calibre. So I am hoping someone here has low level knowledge of the MOBI file format.

I am attaching a sample file (recipes.mobi) that I have exported from my application. The index shows up, but the links don't do anything when you click them?

I am also attaching the source (recipes.htm) document. This uses simple HTML linking such as

Code:

<a href="#recipe1">Recipe 1</a>

in the index and

Code:

<a id="recipe1" />

at the start of each section.

The links work fine in the HTM source (in a web browser).

If I use KindleGen to encode the Recipes.htm source, the links do work correctly. But if I use Unkindle in Calibre to unpack the MOBI file, the HTM doesn't look much different than my original source. I'm clearly missing something in the MOBI encoding.

Why on earth would you reinvent the wheel by trying to write your own program to create mobi files?

My application needs to export to the MOBI format so users can view their documents on Kindle devices (PDF works better for iOS). For a variety of reasons (file size, licensing, personal preference, etc.) I can't rely on third party utilities for this feature.

I already have basic MOBI exporting working fine. External links even work great. It is only the internal links that are not working correctly.