|
|
#1 |
|
Member
![]() Posts: 15
Karma: 10
Join Date: Nov 2025
Device: none
|
Bug or feature in "Edit Table Of Contents"
In Epub3, using Tools > Table Of Contents > Edit Table Of Contents and clicking "OK" without making any edits changes the file toc.xhtml. The formatted entries that are actually displayed in the ebook (most nav entries are hidden) change to a numbered list of links without formatting:
OLD: Code:
<body>
<nav epub:type="toc" id="toc" role="doc-toc">
<h1 class="toc-title" id="abc">CONTENTS</h1>
<ol class="none" epub:type="list">
<li class="toc-front"><a href="cover.xhtml"><span class="toc_entry">COVER</span></a></li>
Code:
<body>
<nav epub:type="toc" id="toc" role="doc-toc">
<h1>Table of Contents</h1>
<ol>
<li>
<a href="cover.xhtml">COVER</a>
</li>
Is that a bug or a feature? |
|
|
|
|
|
#2 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,227
Karma: 7640012
Join Date: Nov 2009
Device: many
|
Editing the TOC, unless you hit Cancel will create a new standard Sigil format TOC.
It sounds like you hit OK which causes the rebuild. It does not matter if you changed anything or not, Sigil takes the information given by the Edit TOC and recreates the TOC from it. That is expected behaviour. It also sounds as if you are now missing a link to a css stylesheet for that nav that controls the numbering or not. A standard Sigil format Nav typically includes its own linked stylesheet. Simply editing that newly created stylesheet will enable you to control the numbering and what gets hidden. FYI, people often add and remove headings and chapters while editing, and so it is often easier to simply generate the entire TOC using Sigil tools once near the end, editing it as needed in the TOC editor, or editing the Nav directly in CodeView before going final. Editing a custom TOC not originally generated by Sigil may not be what you want, especially if you did not Cancel or exit that Dialog. If you do not like that change, assuming you have created a Checkpoint (which is always a good idea) you can easily revert. Last edited by KevinH; 11-12-2026 at 03:09 PM. |
|
|
|
|
|
#3 |
|
Member
![]() Posts: 15
Karma: 10
Join Date: Nov 2025
Device: none
|
I think the trouble is that the file toc.xhtml serves double duty as the nav file and as the visible table of contents.
I can fix that by making a copy of the file. That copy is then unaffected by a recreation of the toc and retains its formatting. The trouble with that particular epub3 is that there are lots of links to the original toc.xhtml which all get broken as soon as I edit the toc via the menu because all the ids are lost. Also, there is a toc.ncx file in addition to the toc.xhtml "nav" file. I'm not sure what that's about. I thought the ncx file is for epub2 only? |
|
|
|
|
|
#4 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,948
Karma: 212736643
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
The toc.ncx can be safely deleted from an EPUB3, but many leave it in for backward compatibility with EPUB2 reading systems. For basic things like novels, most vanilla EPUB3s can be read in EPUB2 reading systems just fine (unless the toc.ncx is missing).
|
|
|
|
|
|
#5 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,227
Karma: 7640012
Join Date: Nov 2009
Device: many
|
And you can rename the nav to anything. It need not be named nav.xhtml nor toc.xml. Start with a fresh copy, In Sigil, duplicate toc.xhtml and create a toc2.xhtml. Rename the existing toc.xhtml to nav.xhtml.
I think if done in that order, all external links to the original toc.xhtml should all be auto updated to point to the nav.html. Edit and rename the toc2.xhtml till your heart is content. Worth a try at least. Last edited by KevinH; 11-12-2026 at 04:54 PM. |
|
|
|
|
|
#6 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,227
Karma: 7640012
Join Date: Nov 2009
Device: many
|
Alternatively you could use Sigil to create an HTML toc from your current nav, and then edit that.
|
|
|
|
|
|
#7 |
|
Member
![]() Posts: 15
Karma: 10
Join Date: Nov 2025
Device: none
|
Thanks guys!
I created a copy of the NAV file, renamed that to contents.xhtml, edited "contents" and changed all the links in the epub from "nav" to "contents". That did the trick. For the extraneous toc.ncx I also kept, EpubCheck gives me the message OEBPS/toc.ncx,140,4833,Col: 48: ERROR(RSC-007): Referenced resource "OEBPS/Text/discover-page.xhtml" could not be found in the EPUB. Of course, since this is an Epub3 file, deleting the file "discover-page.xhtml" will only edit the NAV file, not the NCX file, but I think I can live with that error check message. Manually deleting the file entry from toc.ncx unfortunately only channges the error message, because then there is a gap in the internal numbering: OEBPS/toc.ncx,136,4710,Col: 48: ERROR(RSC-005): Error while parsing file: playOrder sequence has gaps Would it be possible to update both the NAV and the NCX file in an Epub3 if both files are present? Cheers and keep up the good work! |
|
|
|
|
|
#8 |
|
Member
![]() Posts: 15
Karma: 10
Join Date: Nov 2025
Device: none
|
P.S.: Good thing I kept the toc.ncx. My Tolino Vision 4 HD is displaying that instead of the NAV file.
|
|
|
|
|
|
#9 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,227
Karma: 7640012
Join Date: Nov 2009
Device: many
|
Go to Sigil Tools menu and from it select the Epub3 Tools menu. These are the epub3 specific tools to delete the guide and ncx. There is another tool there to recreate the guide and ncx based in the current nav. So no need to manually edit the ncx. There are also tools to update Manifest properties.
So once you are happy with the nav, use the epub3 tools to delete the guide and ncx, then the epub3 tool to create the guide and ncx based in your nav so that they match. Then as a last step, run the Update Manifest properties tool just to be safe. Last edited by KevinH; 11-13-2026 at 11:09 AM. |
|
|
|
|
|
#10 |
|
Member
![]() Posts: 15
Karma: 10
Join Date: Nov 2025
Device: none
|
Awsome! Thanks a lot.
I noticed a funny thing, though. If I do exactly the following: 1) Tools > Epub3 Tools > Remove the NCX and Guide 2) Tools > Restructure Epub to Sigil Norm 3) Tools > Epub3 Tools > Generate NCX/Guide for epub2 e-readers 4) Tools > Restructure Epub to Sigil Norm then non-breaking spaces * in the NAV are translated into &#160; in the NCX. |
|
|
|
|
|
#11 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,227
Karma: 7640012
Join Date: Nov 2009
Device: many
|
Telling Sigil to Preserve Entities simply tells Sigil's gumbo parser to convert them back to entities after any parsing action. So any Sigil tool that parses that file (such as Mend or Reformat All with Mend, or ...) will replace the actual char with the entity you specified as part of that parsing process. Typically you tell Sigil which entities to preserve before starting to edit a epub for the first time. How did you actually enter that entity in Preserve Entities? If you do not want to preserve that entity, then remove it from Preserve Entities the run Reformat All with Mend before creating the Guide and NCX. The ncx is pure xml not xhtml like the nav.
And FWIW, Restructuring to Sigil Norm is typically done once just before starting to edit the epub the first time. Once done, new files created by Sigil should follow those rules. Running it repeatedly should never be needed. Last edited by KevinH; Yesterday at 09:25 AM. |
|
|
|
|
|
#12 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,948
Karma: 212736643
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I believe the non-breaking space is in the preserve entities list for epub3 by default. It's the only entry I think. It can absolutely be safely removed though.
|
|
|
|
|
|
#13 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,948
Karma: 212736643
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Unless &#160; is literally what's showing up in your epub (and it's not merely an artifact of Mobileread's bbcode rendering). That would be a problem.
|
|
|
|
|
|
#14 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,682
Karma: 154365285
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
It is actually &#160;. I tested posting an actual non-breaking space and the forum converted it to an *.
|
|
|
|
|
|
#15 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,227
Karma: 7640012
Join Date: Nov 2009
Device: many
|
Then, yes that is a problem with the python ncx generation code with entities. All entities need to be converted to actual chars first, the generation done, then putting any entities needed back. I will look into fixing that.
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| No Table of Contents and "This HTML file is larger than 260 KB" Error | rosewood | Conversion | 13 | 02-07-2023 12:58 PM |
| PRS-T3 "Table of contents" button on every page | Leon74 | Sony Reader | 2 | 01-04-2014 12:48 PM |
| Change name of autogenerated "Table of Contents" | Dzoni | Conversion | 7 | 03-16-2011 04:44 AM |
| Generating a rough "table of contents" | Vanguard3000 | Calibre | 5 | 01-09-2011 11:31 PM |
| TOO SLOW to open "Table of Contents" | mdhuang | Sony Reader | 16 | 09-06-2007 11:29 PM |