Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sub-chapters in ePub file

Tags:

xml

epub

The NCX file an ePub file can specify the chapters that have the book in ePub format.

It uses the following XML syntax:

<navPoint class="chapter" id="chapter1" playOrder="1">
      <navLabel><text>Chapter 1</text></navLabel>
      <content src="file1.xhtml"/>
</navPoint>

My question is, can we create sub-chapters? If so, how?

I have searched Google and all I've found are very specific tools to perform these tasks. I do not want a tool, I want to know how to make sub-chapters in the NCX file.

like image 410
Lobo Avatar asked Feb 01 '26 15:02

Lobo


1 Answers

Change the depth to the number of levels

<meta content="2" name="dtb:depth"/>

Put a navPoint inside the navPoint that must contain the sublevel. Remember to close the navPoint!

<navPoint class="chapter" id="chapter1" playOrder="1">
      <navLabel><text>Chapter 1</text></navLabel>
      <content src="file1.xhtml"/>

  <navPoint class="subchapter" id="sub1" playOrder="2">
    <navLabel><text>Subchapter 1</text></navLabel>
    <content src="file2.xhtml"/>
  </navPoint>

</navPoint>
like image 104
macjohn Avatar answered Feb 04 '26 03:02

macjohn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!