Skip to content

Footnotes

Maxwell Simmer edited this page Sep 15, 2023 · 6 revisions

Footnotes

Footnotes should be placed at the end of the markdown file where the footnote needs to be included. During build, b-ber collects the notes, puts them in a notes.xhtml file, and links them appropriately.

Markdown (input)

<!-- my-project.md -->

Here is some text.[^1] Here is some more text.[^2]

[^1]: Here is the text for footnote one.
[^2]: Here is the text for footnote two.

HTML (output)

<!-- my-project.xhtml -->

<p>Here is some text.<a epub:type="noteref" class="footnote-ref" href="notes.xhtml#fn1" id="fnref1">1</a> Here is some
    more text.<a epub:type="noteref" class="footnote-ref" href="notes.xhtml#fn2" id="fnref2">2</a></p>
<!-- notes.xhtml -->

<ol class="footnotes">
  <li class="footnote" epub:type="footnote" id="fn1">
    <p>Here is the text for footnote one.<span hidden="hidden" class="hidden-backlink"><a
          href="my-project.xhtml#fnref1"></a></span></p>
  </li>
  <li class="footnote" epub:type="footnote" id="fn2">
    <p>Here is the text for footnote two.<span hidden="hidden" class="hidden-backlink"><a
          href="my-project.xhtml#fnref2"></a></span></p>
  </li>
</ol>

Details

Given the following markdown document,

This is a[^1] sentence

[^1]: ibid
  • in This is a[^1] sentence, [^1] is the reference
  • in [^1]: ibid, [^1]: is the footnote

Options

Footnotes rendering can be controlled by using the group_footnotes option in the config.yml. The default setting group_footnotes: false will create a new section for each chapter, and the numbering will restart at 1. group_footnotes: true will not reset the footnote counter on every chapter.

Rules

  • Footnotes must be in the same document as their references.

Behavior

  1. A notes.xhtml page is automatically generated when running bber build.
  2. All footnotes will appear in notes.xhtml under the chapter heading where their references appear.
  3. All footnotes in notes.xhtml will have a link back to their references. bber build does this automatically.
  4. notes.xhtml will be given the attribute linear="no" in the content.opf, so that it is hidden from the regular flow of an EPUB. Please note: notes.xhtml will appear in the regular flow of the Mobi, since Mobi does not support linear="no".
  5. Clicking on a reference in a Mobi file, or an EPUB file if this behavior is supported in the reading software, will open a small modal window with the footnote.
  6. notes.xhtml should not appear in the table of contents.
Clone this wiki locally