azw3

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package azw3 renders a parsed EPUB into a KF8/AZW3 book using github.com/leotaku/mobi — no Calibre, no external tools.

The EPUB's spine documents become KF8 chapters: each document's body content is passed through nearly verbatim (KF8 is HTML+CSS underneath), with resource references rewritten to the kindle:embed / kindle:flow scheme, re-serialized as strict XHTML, and split into small balanced chunks (Kindle renders oversized or non-XML fragments as empty pages). The cdetype (EXTH 501) is written at generation time, so no post-patching is needed.

In-book hyperlinks (footnote jumps, cross-references) become real KF8 position links: hrefs are written as fixed-width placeholders, chunking records where every link target lands, and the placeholders are patched to kindle:pos:fid:off form (see links.go). JPEG/PNG/GIF images are embedded byte-for-byte — no re-encoding, transparency preserved; only device-unsafe variants (progressive/CMYK JPEG, other formats) are re-encoded as JPEG (see images.go).

Known simplifications, chosen to keep sideloaded reflowable books working well rather than to cover every EPUB feature:

  • embedded fonts are dropped (@font-face is stripped; the device renders with its built-in fonts, which cover CJK)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(book *epub.Book, outPath string, opts Options) ([]string, error)

Write renders book to an AZW3 file at outPath. It returns non-fatal warnings (skipped images, missing cover, …).

Types

type Options

type Options struct {
	Title   string
	Author  string
	DocType string // "PDOC" (default) or "EBOK"
}

Options control the generated book's metadata.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL