epub HTML Table of Contents entries don't link to subheadings

I’m having a number of challenges generating a working epub, for reasons that include my own limited knowledge, getting to know S3 and a degree of complexity in the book.

My issue now is that the table of contents is showing up validation errors which I have tracked back to a problem with the HTML table of contents.

As I have a nested ToC that wasn’t working I generated a table of contents in a new file in my project using the Edit/Copy Special/Copy Documents as Structured Link List function. This created the table of contents I wanted and it works well inside Scrivener. When I compile, I use the Generate HTML Table of Contents option, naming my ToC to match my previously created file, as per the manual (p570).

At first look this works well. The created epub3 file has a nice neat Table of Contents which matches the one I created in Scrivener. However, it doesn’t work properly. On deeper inspection I find that the links created in the HTML ToC are anchors that don’t go anywhere.

Here’s a sample of the contents.xhtml code:


  1. Shared intent and expectations
  2. Values
  3. Integrity
  4. Competence and capabilities
  5. Accountability and belief loop

Note the anchor links: #doc22, #doc23, etc. The problem is that the corresponding anchors don’t exist in the relevant document (body6.xhtml in this case). If I dig into the body6.xhtml code, the line for the relevant heading is:

<p class="heading-3">Shared intent and expectations </p>

Note no reference to #doc22. If you click on a second or third level heading in the ToC, it just takes you to the start of the relevant chapter, not to the relevant section.

I don’t know if there is something I am doing wrong in my control settings or if this is a bug. Any input would be appreciated.

This is a bug. I’ve fixed it for 3.0.2, but in the meantime you can work around it by ticking “Convert document links to HTML links” in the Compile options. This will force Scrivener to add the necessary anchors. (Note that upon ticking this, you will need to make sure that your table of contents has a title with a header style applied, though - another bug fixed for 3.0.2 means that if you don’t do this, the anchor inserted may affect the indention of the first items in the list.)

All the best,

Bingo! Thanks Keith – you’ve done it again :slight_smile:

Successful validation now.

I’m using the Windows version of the software and all my internal links are gone for both .epub and .mobi. I do not see an option in the Windows version Compile for “Convert document links to HTML links”

If it is there, can you post a screenshot of how to set it? Having all internal links fail to function is a huge problem.

This function does not exist in the release version of Windows Scrivener. It’s coming in Win Scrivener 3, but I don’t know if the current beta has it.


Can you find out if the beta has it and let me know how to download it for Windows? Obviously, I cannot publish an ebook without internal linking. And you should let your customers know before buying that internal linking will not work on a Scrivener for Windows compiled ebook. I probably would have explored other options had I known such basic functionality was missing.