digital libraries,
web preservation,
books,
archives.

The missing feature in digital libraries: searchable tables of contents

2025-10-12 tags: ebooks epub readium library catalogs

In the context of electronic books, I've always been frustrated by how reading applications relegate navigation of table of contents to a minor feature in their UI/UX.

(Note: Throughout history, indexes — those alphabetical listings at the back of books — have been crucial for knowledge access, as Dennis Duncan explores in "Index, A History of the". But this post focuses on tables of contents, which show the hierarchical structure of chapters and sections.)

I find it very useful to view the table of contents before opening a book. I often do this in the terminal. You can easily create your own script in any programming language using an existing library for EPUB files (or PDF, or whatever the format you need to read). For EPUB files, the simplest approach I have found is to use Readium CLI and jq to print a tree-like structure of the book. This is the script I use:

#!/bin/bash

# Usage: ./epub-toc.sh <epub-file>

if [ $# -eq 0 ]; then
    echo "Usage: $0 <epub-file>" >&2
    exit 1
fi

EPUB_FILE="$1"

if [ ! -f "$EPUB_FILE" ]; then
    echo "Error: File '$EPUB_FILE' not found" >&2
    exit 1
fi

if ! command -v readium &> /dev/null; then
    echo "Error: 'readium' command not found. Please install readium-cli." >&2
    exit 1
fi

if ! command -v jq &> /dev/null; then
    echo "Error: 'jq' command not found. Please install jq." >&2
    exit 1
fi

readium manifest "$EPUB_FILE" | jq -r '
  def tree($items; $prefix):
    $items | to_entries[] |
    (if .key == (($items | length) - 1) then
      $prefix + "└── "
    else
      $prefix + "├── "
    end) + .value.title,
    (if .value.children then
      tree(.value.children; $prefix + (if .key == (($items | length) - 1) then "    " else "│   " end))
    else
      empty
    end);

  if .toc then
    tree(.toc; "")
  else
    "Error: No .toc field found in manifest" | halt_error(1)
  end
'
Example of a book with a long and nested table of contents
~ readium-toc La_comunicazione_imperfetta_-_Peppino_Ortoleva_Gabriele_Balbi.epub
├── Copertina
├── Frontespizio
├── LA COMUNICAZIONE IMPERFETTA
├── Introduzione
│   ├── 1. I percorsi movimentati, e accidentati, del comunicare.
│   ├── 2. Teorie lineari della comunicazione: una breve archeologia.
│   ├── 3. Oltre la linearità, verso l’imperfezione.
│   └── 4. La struttura del libro.
├── Parte prima. Una mappa
│   ├── I. Malintesi
│   │   ├── 1. Capirsi male. Un’introduzione al tema.
│   │   ├── 2. Una prima definizione, anzi due.
│   │   ├── 3. A chi si deve il malinteso.
│   │   ├── 4. Il gioco dei ruoli.
│   │   ├── 5. L’andamento del malinteso.
│   │   ├── 6. Le cause del malinteso.
│   │   │   ├── 6.1. Errori e deformazioni materiali.
│   │   │   ├── 6.2. Parlare lingue diverse.
│   │   │   ├── 6.3. La comunicazione non verbale: toni, espressioni, gesti.
│   │   │   ├── 6.4. La comunicazione verbale: l’inevitabile ambiguità del parlare.
│   │   │   ├── 6.5. Detto e non detto.
│   │   │   └── 6.6. Sovra-interpretare.
│   │   ├── 7. Le conseguenze: il disagio e l’ostilità.
│   │   ├── 8. La spirale del non capirsi.
│   │   ├── 9. Uscire dal malinteso.
│   │   └── 10. Il ruolo del malinteso nella comunicazione umana.
│   ├── II. Malfunzionamenti
│   │   ├── 1. Malfunzionamenti involontari.
│   │   ├── 2. Malfunzionamenti intenzionali.
│   │   ├── 3. (In)tollerabilità del malfunzionamento.
│   │   ├── 4. Contrastare il malfunzionamento: manutenzione e riparazione.
│   │   ├── 5. Produttività del malfunzionamento.
│   │   └── 6. Relativizzare il malfunzionamento: per una conclusione.
│   ├── III. Scarsità e sovrabbondanza
│   │   ├── 1. Il peso della quantità.
│   │   │   ├── 1.1. La scarsità informativa: effetti negativi e produttivi.
│   │   │   ├── 1.2. La sovrabbondanza informativa: effetti negativi e produttivi.
│   │   │   └── 1.3. Qualche principio generale.
│   │   ├── 2. Politiche della scarsità e politiche dell’abbondanza.
│   │   │   ├── 2.1. Accesso all’informazione, accesso al potere.
│   │   │   └── 2.2. Controllare la circolazione dell’informazione: limitare o sommergere.
│   │   ├── 3. Scarsità e abbondanza nell’economia della comunicazione.
│   │   │   ├── 3.1. Il valore dell’informazione tra domanda e offerta.
│   │   │   ├── 3.2. L’economia dell’attenzione.
│   │   │   └── 3.3. I padroni della quantità.
│   │   ├── 4. Le basi tecnologiche della scarsità e della sovrabbondanza.
│   │   │   ├── 4.1. Effluvio comunicativo e scarsità materiale.
│   │   │   └── 4.2. Scarsità e abbondanze oggettive o create ad arte.
│   │   └── 5. Gestire il troppo e il troppo poco.
│   │       ├── 5.1. Il troppo stroppia o melius est abundare quam deficere?
│   │       ├── 5.2. Colmare un ambiente povero di informazioni.
│   │       └── 5.3. Due concetti relativi.
│   └── IV. Silenzi
│       ├── 1. La comunicazione zero.
│       │   ├── 1.1. La presenza dell’assenza.
│       │   ├── 1.2. I silenzi comunicano.
│       │   └── 1.3. Silenzi codificati e silenzi enigmatici.
│       ├── 2. Il silenzio del mittente.
│       ├── 3. Il silenzio del ricevente.
│       ├── 4. Il silenzio dei pubblici.
│       ├── 5. Silenzi parziali: le omissioni.
│       ├── 6. Il valore del silenzio: il segreto.
│       │   ├── 6.1. Una breve tipologia dei segreti.
│       │   ├── 6.2. Preservare e carpire i segreti.
│       │   └── 6.3. Ancora sulla fragilità del segreto.
│       └── 7. I paradossi del silenzio.
├── Parte seconda. Verso una teoria
│   └── V. La comunicazione è imperfetta
│       ├── 1. L’imperfezione inevitabile.
│       ├── 2. Correggere, rimediare.
│       │   ├── 2.1. Prima dell’invio: le correzioni umane, e non.
│       │   ├── 2.2. Durante l’invio.
│       │   └── 2.3. E quando la comunicazione ha già raggiunto il destinatario o l’arena pubblica?
│       ├── 3. Le vie dell’adattamento.
│       │   ├── 3.1. Avere tempo.
│       │   ├── 3.2. Adattarsi e adattare a sé.
│       │   └── 3.3. Tra le persone, con gli strumenti.
│       └── 4. Dal lineare al non lineare e all’imperfetto.
├── Bibliografia
├── Il libro
├── Gli autori
└── Copyright

The readium manifest command prints a unified representation of a publication, in JSON format.

But this is just a hacky trick, nothing more.

The serious discussion I'd like to engage in — though I'm not sure where or which community would be best for this — is whether online book catalogs, from both stores and public libraries, publish their books' table of contents and whether those are searchable. Is this a technical limitation, a licensing restriction from publishers, or simply an overlooked feature? Being able to search within tables of contents would significantly improve book discovery and research workflows.

Here are some examples I know so far:

Digitocs by University of Bologna

DigiTocs is a service launched by the University of Bologna in 2009 that provides online access to indexes, tables of contents, and supplementary pages from books cataloged in their library system. The service works through a distributed network of participating university libraries, each responsible for digitizing and uploading pages along with OCR-generated text and metadata. The platform is integrated with the library's OPAC (online catalog), allowing users to view and search digitized indexes and tables of contents directly from catalog records (example book and its TOC).

Neural Archive

Neural Archive is the online catalog of the library maintained by Neural Magazine. For each book they review, they publish high-quality cover images, minimal metadata, and the book's TOC.

Out of context

Read J.G. Ballard's short story, The Index (1977)


This blog has no comments or webmentions, so let's continue the discussion on the fediverse, I am @raffaele@digipres.club.