Documentation
Notes
Footnotes, rearnotes or any kind of notes found in content must back link regardless if they exist in the same file or another file as this is a channel requirement, example:
html1<p class="text">2Bacon ipsum dolor amet capicola chicken rump porchetta, meatball short loin filet mignon hamburger3leberkas ham hock strip steak jowl pork alcatra ribeye.<a4id="backlink-footnote-1"5href="footnote-1"6><span class="superscript">1</span></a7>8</p>9<!-- More Content -->10<p class="footnote">11<a id="footnote-1" href="backlink-footnote-1">1.</a> Ribeye jowl meatball tongue cupim meatloaf12ball tip sausage brisket pastrami.13</p>
Location
Notes can be placed at the end of each chapter or in a XHTML named backmatter. If a XHTML is to be used the notes are to be the last XHTML file. This rule placement order doesn't apply to notes that are in referenced in the PDF. For example:
Below HTML assumes a page with a header and the last pagebreak
is a blank white page.
html1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html>3<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">4<head>5<title>Note Example</title>6<link href="../css/idGeneratedStyles.css" rel="stylesheet" type="text/css" />7<link href="../css/epub3.css" rel="stylesheet" type="text/css" />8</head>9<body epub:type="backmatter">10<section epub:type="rearnotes">11<a epub:type="pagebreak" id="page209" title="209"></a>12<p class="cht">Notes</p>13<p class="notes">14<a id="rearnote-ch02-1" href="SC02_chapter02.xhtml#rearnote-backlink-ch02-1">1</a>. Note15text here.16</p>17<p class="notes">18<a id="rearnote-ch07-2" href="SC02_chapter07.xhtml#rearnote-backlink-ch07-2">2</a>. Note19text here.20</p>21<a epub:type="pagebreak" id="page210" title="210"></a>22</section>23</body>24</html>
Multi Span
For some reason an InDesign's exported notes are within multiple spans, example:
html1<span class="superscrpt">2<span id="footnote-328-backlink">3<a class="_idFootnoteLink _idGenColorInherit" href="output.xhtml#footnote-328">2025</a>4</span>5</span>
This can be cleaned regex:
bash1## Find:2<span class="([A-Za-z_-]+)"><span id="footnote-(\d{1,5})-backlink"><a class="_idFootnoteLink _idGenColorInherit" href=".*\.xhtml#footnote-\2">(\d{1,5})</a></span></span>34## Replace:5<span id="footnote-\2-backlink" class="\1"><a href="03_backmatter\.xhtml#footnote-\2">\3</a></span>
which outputs:
html1<span id="footnote-328-backlink" class="superscrpt">2<a href="03_backmatter.xhtml#footnote-328">2025</a>3</span>
Chapter Removal
If there are a low number of notes and the note numerical count isn't reset/starts with 1 on each new chapter the chapter ref can be removed, example:
Before
Chapter file (links to back):
html1<a id="rearnote-backlink-ch02-1" href="SC03_backmatter01.xhtml#rearnote-ch02-1">2<span class="superscript">1</span>3</a>
Backmatter file (links to content):
html1<a id="rearnote-ch02-1" href="SC02_chapter02.xhtml#rearnote-backlink-ch02-1">1</a>
After
Chapter file (links to back):
html1<a id="rearnote-backlink-1" href="SC03_backmatter01.xhtml#rearnote-1">2<span class="superscript">1</span>3</a>
Backmatter file (links to content):
html1<a id="rearnote-1" href="SC02_chapter02.xhtml#rearnote-backlink-1">1</a>
Regex
Following regex will trim chapter.xhtml and backmatter.xhtml files:
bash1## Find:2(?<=rearnote|backlink)-ch\d+-(?=\d)34## Replace:5-