• Complain

Harrison - Ebook Formatting: KF8, Mobi & EPUB

Here you can read online Harrison - Ebook Formatting: KF8, Mobi & EPUB full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2013, publisher: hairysun, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Harrison Ebook Formatting: KF8, Mobi & EPUB
  • Book:
    Ebook Formatting: KF8, Mobi & EPUB
  • Author:
  • Publisher:
    hairysun
  • Genre:
  • Year:
    2013
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

Ebook Formatting: KF8, Mobi & EPUB: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Ebook Formatting: KF8, Mobi & EPUB" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Illustrated HTML and CSS reference for Kindle Mobi, KF8 and EPUB

Ebook Formatting: KF8, Mobi & EPUB — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Ebook Formatting: KF8, Mobi & EPUB" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Ebook Formatting:
KF8, Mobi & EPUB
Matt Harrison

hairysun.com

Matt Harrison

Copyright 2013

While every precaution has been taken in the preparation of thisbook, the publisher and author assumes no responsibility for errorsor omissions, or for damages resulting from the use of theinformation contained herein.

2013-04-15

Table of Contents
Introduction

A good deal of the ebooks found in online stores today haveproblematic formatting. Even huge book including the Harry Potterseries and Walter Isaacsons Steve Jobs biography were released withformatting errors. Ebook Formatting: KF8, Mobi & EPUB is thesolution to those issues.

A word of warning: this book is not a walkthrough for creatingebooks. It will not show how to create an ebook from a Word file orfrom scratch. It assumes that the reader has a mechanism to create anEPUB file. It does not discuss tools such as Scrivener or Sigil.

This book is not an introduction to HTML nor CSS. It is assumed thatthe reader has a basic knowledge of these technologies.

While many tools will generate HTML, few of them generate the HTML andCSS necessary for well formatted EPUB or Mobi files. Most professionalebook creators are dealing directly with HTML and CSS at some point inthe creation process, because the WYSIWYG and traditional desktoppublishing tools lack the support to create ebooks that look great outof the box.

The purpose of this book is to provide examples of commonfunctionality needed for textual ebooks. The focus is on HTML thatwill work for EPUBs and cleanly convert to both Mobi 7 and KindleFormat 8 (KF8) files using KindleGen. Included with the examples isthe source code as well as examples illustrating the out of the boxrendering and the enhanced CSS rendering. Though best efforthas been made to ensure the examples work on all platforms, there arelimitations and some features are not supported across every platform.

Cleaning up a book

Preliminary cleaning of generated HTML can be done by hand, usingtools such as htmltidy, search and replace mechanisms, or by usingscripts or programs to manipulate the content. Manual clean up isuseful for full control, but can be prone to errors and is timeconsuming. Tools like htmltidy and epubcheck can help to ensurethat the HTML conforms to W3C specs. Sadly, this is not sufficient inorder to have well behaved ebooks. Some level of programming isrequired to speed up the process that hand tweaking provides.

Scripting can be used to provide wholesale or fine grained search andreplace to fix problematic exports. Especially when the source of yourbooks is well known and self-consistent. A common search and replaceor regex (short for regular expression) can clean up and remove manyextraneous tags and other issues. Regexes are more powerful than justsearch and replace because it allows for fuzzy matching andreplacing. Most programming languages and editors have some notion ofsupport for them. Though using regexes to parse HTML that is notwell-formed can be problematic.

During the production of this book, the HTML was generated bothprogrammatically and by hand. A CSS file was created to support thefunctionality found in the chapters. The source of the CSS isavailable in the appendix as well as online as the EPUB CSS StarterKit. The CSS is licensed under the MIT license and as such isappropriate for use in both commercial and non-commercialpublications.

Structure

The structure of this book as follows. Groups of chapters are devotedto a subject related to ebook formatting. Most of the groups have fourchapters:

  • Native Rendering - illustrating the native device rendering ofmarkup. If the publisher defaults are off, this output may besimilar to that. There is no CSS applied nor a CSS reset applied.
  • CSS Rendering - illustrating the rendering using the standardizedCSS file (which includes a reset) from the EPUB CSS Starter Kit.
  • Source - Source to files shown in the two rendering chapters. Thisis only the content. The HTML code common to all pages isfound in the appendix.
  • Discussion - Pertinent discussion relative to markup, CSS andplatform support.
Device Support

Given that 70% of ebook sales are on the Kindle platform, every efforthas been made to ensure the examples work on that platform. KindleFormat 8 is referred to as KF8, while Mobi7 will refer to theprevious Kindle format. EPUB support for the Nook, iBooks and Kobo wastested as well. Beyond those platforms is a very small percent of themarket. In essence those big four platforms are where people areactually buying books. If you have missing examples or find theexamples provided are not working please feel free to notify theauthor.

Exploding EPUB

This chapter will explode (actually merely unzip) a basic EPUB file, anddescribes the contents of it.

An EPUB file is just a zip file that has the extension changed to .epub . On a unix platform (MacOS or Linux) you can extract thecontents of an EPUB file like this:

$ unzip sample.epub -d sampleEPUB

This will extract the contents of the EPUB into a directory named sample . My EPUBs tend to look something like this:

sample mimetype META-INF container.xml OEBPS content.opf toc.ncx cover.html cover.png main.css toc.html title-page.html 2.html 3.html 4.html 5.html

If you are motivated you can create an EPUB by hand by replicating thefolder structure here and adding the files. This might prove to besomewhat tedious in practice because .xml files are somewhatstrict about their format and typos or case insensitive mistakes couldlead to a bit of time debugging issues.

Regardless this chapter will cover the contents of the structure togive you an idea of what is really contained in an EPUB.

Given that most creators use EPUBs to create Kindle ebooks, there isno coverage of Mobi7 nor KF8 in this chapter. The appendix has moreinformation about extracting the actual contents of those files.

mimetype

mimetype is just a file containing the content:

application/epub+zip

It indicates to ereader devices what kind of file the .epub fileactually is. It might seem like overkill given the name of theextension, but it is part of the EPUB standard.

The only thing special about this file is that it must not becompressed within the EPUB file. The appendix gives an example of howto create an EPUB from a directory and the incantation for adding the mimetype file so that it is not compressed.

META-INF/container.xml

In the META-INF folder is a file named container.xml . Thisfile describes the contents of the EPUB. Here is an example:

The most interesting part of this file is that it points to anotherfile, OEBPS/content.opf , found in the zip archive. This locationis relative to the root directory.

OEBPS/content.opf

Most of the content in an EPUB is in the OEBPS (this stands forOpen EBook Publication Structure) directory. The .opf (this standsfor Open Packaging Format) file referenced in container.xml is afile that describes the package structure of the ebook. Morespecifically it explains the:

  • metadata
  • manifest
  • spine contents
  • guide contents

This file does not need to be named content.opf , but it needs tohave that named that was described as the full-path in the containter.xml file. In the unzipped EPUB the content.opf contains the following:

urn:uuid:ea96660c-8acf-11e2-9a71-001cbf0f91d2 en-US Example rst2epub2.py Book Matt Harrison Matt Harrison Copyright 2011 -- Matthew Harrison -- All rights reserved Example of using rst for your book English reStructuredText for ebooks
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Ebook Formatting: KF8, Mobi & EPUB»

Look at similar books to Ebook Formatting: KF8, Mobi & EPUB. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Ebook Formatting: KF8, Mobi & EPUB»

Discussion, reviews of the book Ebook Formatting: KF8, Mobi & EPUB and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.