From 1336e51c402f0da078581a826b8fe848206aa91e Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Thu, 16 Dec 2021 15:11:55 +0800 Subject: [PATCH] Allow `span` in toc nav items According to https://www.w3.org/publishing/epub32/epub-packages.html#sec-package-nav-def-model: "A child `a` element describes the target that the link points to, while a `span` element serves as a heading for breaking down lists into distinct groups (for example, a large list of illustrations can be segmented into several lists, one for each chapter)." --- src/navigation.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/navigation.js b/src/navigation.js index 8d593a8..801598b 100644 --- a/src/navigation.js +++ b/src/navigation.js @@ -191,7 +191,8 @@ class Navigation { */ navItem(item, parent) { let id = item.getAttribute("id") || undefined; - let content = filterChildren(item, "a", true); + let content = filterChildren(item, "a", true) + || filterChildren(item, "span", true); if (!content) { return;