Supplemental Content with Docinfo

It’s possible to inject supplemental content into the output document using docinfo files. This core feature of AsciiDoc has been adapted to work with the reveal.js converter.

header/footer changed meaning in v6. If you have an existing docinfo-header-revealjs.html or docinfo-footer-revealjs.html (or the private, per-document equivalents), see the migration guide to find out whether you need to rename it.

Insertion locations

Here’s every insertion location this converter defines, in document order:

<html>
  <head>
    ...
    <!-- [1] head -->
  </head>
  <body>
    <!-- [2] header (alias: body-header) -->
    <div class="reveal">
      <div class="slides">
        <!-- [3] slides-header -->
        <section>
          <!-- [4] slide-header -->
          ...slide content...
          <!-- [5] slide-footer -->
        </section>
        <!-- [4]/[5] repeat for every slide, horizontal and vertical -->
        <!-- [6] slides-footer -->
      </div>
    </div>
    <script>/* Reveal.initialize(...) */</script>
    <!-- [7] footer (alias: body-footer) -->
  </body>
</html>
# Location Filename

1

head
content is inserted just before </head>

docinfo-revealjs.html

2

header (alias body-header)
content is inserted right after <body>, before the .reveal element

docinfo-header-revealjs.html (docinfo-body-header-revealjs.html)

3

slides-header
content is inserted before the first slide (or before the title slide, if any)

docinfo-slides-header-revealjs.html

4

slide-header
content is inserted as the first child of every slide’s <section>, horizontal and vertical alike

docinfo-slide-header-revealjs.html

5

slide-footer
content is inserted as the last child of every slide’s <section>, horizontal and vertical alike

docinfo-slide-footer-revealjs.html

6

slides-footer
content is inserted after the last slide, still inside .slides

docinfo-slides-footer-revealjs.html

7

footer (alias body-footer)
content is inserted just before </body>, after reveal.js is initialized

docinfo-footer-revealjs.html (docinfo-body-footer-revealjs.html)

header/footer are named to match Asciidoctor’s own HTML5 converter, where header/footer also mean "first/last child of <body>`" — so a docinfo file written for the `html5 backend is inserted at the same conceptual position when you switch to revealjs. The body-header/body-footer aliases exist only to spell that out explicitly when it helps readability; both names resolve to the exact same insertion point, and content from both files is included if you happen to provide both.

slide-header/slide-footer apply to every slide, so they’re best suited to something you want repeated on each slide (a running footer with a URL or license notice, a per-slide watermark) rather than one-off content.

Example

Let’s say you want to embed a tweet into your slide deck. You might inject the shared embedding JavaScript once, right after the last slide, using a slides-footer docinfo file:

src/docinfo-slides-footer-revealjs.html
<script src="https://platform.twitter.com/widgets.js"></script>

You then need to set the following document attribute in the AsciiDoc header:

:docinfo: shared

When this attribute is defined, the converter will automatically read the docinfo file(s) and insert the contents into the specified location in the output document.

By default, docinfo files are searched for in the same folder as the document file. If you want to keep them anywhere else, set the docinfodir attribute to their location. Please read Locating docinfo files if you want to learn more.