Each TOC entry carries a 4-byte ASCII type tag. This page documents every tag and describes the data each chunk contains.
CHAP Chapter
Tag: CHAP
The book’s chapter content. The data is either Markdown or HTML text. The markup_type field in the TOC entry determines which format.
| TOC field | Description |
|---|---|
markup_type |
0 tag “1” color:#3b82f6 HTML |
compression |
Typically 1 |
language |
BCP 47 index for chapter language |
Chapter data: UTF-8 encoded Markdown or HTML string
IMG_ Image
Tag: IMG_
The trailing underscore distinguishes this tag from IMG-related variant tags.
An inline image referenced from chapter content.
| TOC field | Description |
|---|---|
compression |
Typically 0 |
content_type |
Image format hint for JPEG, PNG, or WebP |
Image data: raw image bytes in JPEG, PNG, or WebP format
The content type is validated by magic bytes on read. Supported formats include JPEG, PNG, and WebP.
CSS_ Stylesheet
Tag: CSS_
A CSS stylesheet for rendering chapter content.
| TOC field | Description |
|---|---|
compression |
Typically 1 |
CSS data: UTF-8 encoded CSS string
The CSS is parsed and validated with cssparser on write.
FONT Font
Tag: FONT
An embedded font file.
| TOC field | Description |
|---|---|
font_embedding |
Embedding mode such as subset or full |
font_license_url_len |
Length of embedded license URL |
compression |
Typically 0 |
Font data: raw font bytes in WOFF2, TTF, or OTF format
The font format is detected by magic bytes:
| Magic bytes | Format |
|---|---|
wOF2 or \x00\x01\x00\x00 |
WOFF2 |
OTTO |
OTF with CFF outlines |
\x00\x01\x00\x00 |
TTF |
true |
TTF in Mac format |
The font license URL is a UTF-8 string stored as a variable-length field following the standard TOC fields.
COVR Cover Image
Tag: COVR
The full-size book cover image.
Cover data: raw image bytes in JPEG, PNG, or WebP format
COVT Cover Thumbnail
Tag: COVT
An optional downsized version of COVR for quick previews in listing views or ebook reader shelves.
Thumbnail data: raw image bytes in JPEG, PNG, or WebP format
NOTE Note or Annotation
Tag: NOTE
Embedded annotations associated with the file.
Note data: application-defined format
This chunk type stores per-file annotation data. For a richer annotation model that travels with the file, see the org.nisoku.anno EXTRA namespace.
SIDX Search Index
Tag: SIDX
An inverted search index for the book’s content.
SIDX MessagePack structure
{
"version": 1,
"terms": {
"word": [
{"chunk": 0, "positions": [42, 105]},
{"chunk": 2, "positions": [17]}
],
"another": [
{"chunk": 1, "positions": [88]}
]
}
}
Terms are lowercase whitespace-split tokens. chunk refers to the TOC index of the chapter. positions are byte offsets within the decompressed chapter.
See the Search Index feature for usage details.
MATH Math Equation
Tag: MATH
A math equation embedded in the book.
| TOC field | Description |
|---|---|
content_type |
Math format: 0 tag “1” AsciiMath |
Math data: UTF-8 encoded equation string
Equations are rendered at read time by the consuming application, for example with KaTeX or MathJax.