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.
|
|
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 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
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:
<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.