Update – August 2016: I just wanted to note that I now format all my ebooks using Sigil. It's a free ebook formatter, that has all the advantages of Dreamweaver (Clean code, directly edit html etc), but also will compile an NCX table of contents, and other ebook specific formatting. I highly recommend you download it and try it out.blogformat

*NOTE: After a few formatting issues after Amazon recently changed their conversion process for the KF8 format, I realised that I was missing some coding in the style sheet. I've changed the code below to reflect this. For more details about what was happening, check out this post.

There is a lot of advice around the web on formatting kindle ebooks. Some people say never use Word, others say word Works fine. Some say do all of it in HTML. Some suggest using other programs (such as Calibre). I don't know about you, but I found most of it confusing! I can't say that my way is the best way, but it worked for me, and seems to have produced an ebook with no formatting errors.

Why not just use Word?

I tried converting word to filtered HTML (as per the instructions on the Kindle Direct Publishing help page), and tested it using the Kindle Previewer (which I 100% recomend downloading and installing), and it transferred pretty well for a book that was mostly text. But the bloating that remained due to Word's messy HTML just bugged me. And one version did show large segments of text italicised at one point (though I couldn't replicate this a second time?)

Why Dreamweaver?

I wanted a different option. One that was somewhere between completely coding my novel in HTML, and letting Word do all the coding. I picked Dreamweaver because:

* It has a reputation for generating clean HTML
* It allows you to switch between editing the raw HTML, or WISWIG (what you see is what you get) editing. I like to have a split window, showing both at the same time.
* I could shortcut some of the tedious HTML coding by using the Dreamweaver commands, and enter in Kindle specific formatting using the code editor.
* I could download it free using the Adobe Cloud subscription I have for work

The Process:

Creating the document:

First, I created a new document, which puts in the necessary HTML tags such as the head and body tags (head is for commands people won't see, body is for your actual text).

Adding the novel:

Then I copied and pasted my text, chapter by chapter, from Word, into the design view window.

I did it chapter by chapter mostly because Dreamweaver objected to the size when I tried to do it all at once. I have no idea what size it considers acceptable for a webpage, but apparently it's less than 97,000 words! Doing it chapter by chapter though, allowed me to add in the images for my chapter headings (using the Insert->Image command), and to make sure there was a page break (by pasting the kindle specific tag <mbp:pagebreak/> into the code window) between each chapter.

Copying it into the design window (instead of the code window) turned Word's curly quotes into the correct HTML codes (“ etc). It didn't unfortunately, copy paragraph tags properly, using the </br> tag rather than <p> and </p> tags. These I fixed by using a find and replace in the code window.

Then I set a CSS style by pasting the code

<!– CSS –>
<style type=”text/css”>
<!–
.tab { text-indent: 1EM; }
–>
</style>

I selected the paragraphs in bulk, and applied the style (by selecting the option in the properties tab at the bottom of the window). I choose the 1M indent, as I read that it was the industry standard. It is set at the width of the letter M, and thus will adjust with text size.

To avoid the indent on the first paragraph of each chapter or after a scene break, use the command <p style=”text-indent:0″> in place of the <p> tag at the beginning of the paragraph.

Kindle specific bookmarks:

Paste the code <a name=”start” /> at the beginning of  your first chapter. This will enable the user to click on the ‘Beginning' link on the kindle. It will also take the reader directly to the first chapter when they open your book for the first time.

<a name=”toc” /> does the same thing for your table of contents.

Note: These won't work in the kindle previewer or the .mobi file it complies, but will work once you've uploaded.

Creating a Table of Contents:

First, you need to set the bookmarks that the table of contents refers to. Click at the beginning of your chapter, then use the Insert->Named Anchor command to add in each bookmark. Name them something easy to remember. I called mine ‘Ch1' etc.

Then type in each chapter in a list wherever you want your table of contents. I've put mine at the back, and  used line breaks (</br>, or shift->enter) to keep them closer together and use less space). Highlight each chapter, and use the Insert->Hyperlink command. This opens up a little box and the only part you need to worry about is the ‘link' field, where you choose the appropriate link from the drop down box.

And that's pretty much it. Download the Kindle Previewer, check that it all looks good (especially check that all the paragraphs are indented properly, I managed to miss a few in my find and replace). I recommend downloading your book (using the .mobi file the previewer will create in a subfolder) to your kindle or other reading device, and doing a final proofread before uploading.

A couple of issues I noticed. In some formats, the Kindle Previewer cuts off the edges of some images. This seems to be a problem with the previewer, and doesn't translate to the final ebook. The other one I've noticed is that the beginning and table of contents links in the .mobi file that it produces doesn't work in the previewer, but they do once your ebook is uploaded.