The Reveal.js output formatter

AsciidoctorJ Reveal.js is a popular wat of creating slides with AsciidoctorJ and is available via the org.asciidoctor.jvm.revealjs plugin.

There are many items that can be configured on the output formatter itself.

  • Groovy

import org.asciidoctor.gradle.model5.jvm.formatters.AsciidoctorjRevealjs

asciidoc {
    toolchains {
        aciidoctorj {
            registeredOutputFormatters {
                revealjs(AsciidoctorRevealjs) { (1)
                    templateDirs 'src/myAsciidocTemplate1', 'src/myAsciidocTemplate2' (2)
                    forceEngine =  'erb' (3)
                    useEngine 'slim' (4)
                    useEngine 'slim', '1.2.3' (5)
                    revealjsOptions { (6)
                    }
                }
            }
        }
    }
}
1 The org.asciidoctor.jvm.revealjs plugin adds an output formatter called revealjs.
2 Define one or more templates that can be used for conversion.
3 Force AsciidoctorJ to use the specific engine irrespective of the extensions detected in the template directories.
4 Adds an engine to the GEM classpath. Only erb, slim and haml is supported.
5 Adds any engine supported by tilt along with the version of the GEM.
6 Configures AsciidoctorJ Reveal.js options. See below.
templateDirs must be provided, otherwise template setting will be ignored. If the engine is not provided, it will auto-detect engines from the file extensions found in the template directories.

Reveal.js options

  • Groovy

revealjsOptions{
    autoSlideInterval = 200 (1)
    autoSlideStoppable = true (2)
    backgroundTransition = 'none' (3)
    backgroundTransition =  ReveljsOptions.Transition.FADE (4)
    builtinThemeName = 'black' (5)
    builtinThemeName = RevealjsOptions.BuiltInThemes.BEIGE (6)
    controls = true (7)
    flagEmbedded = true (8)
    fragments = true (9)
    hideAddressBarOnMobile = true (10)
    keyboardShortcuts (11)
    loop = true (12)
    mouseWheel = true (13)
    overviewMode = true (14)
    previewLinks = true (15)
    progressBar = true (16)
    pushToHistory = true (17)
    rightToLeft = true (18)
    slideNumber = RevealjsOptions.SlideNumber.DEFAULT (19)
    slideNumber = 'h/v' (20)
    touchMode = true (21)
    transition = 'slide' (22)
    transition = RevealjsOptions.Transition.FADE (23)
    transitionSpeed = 'fast' (24)
    transitionSpeed = RevealjsOptions.Transition.SLOW (25)
    verticalCenter = true (26)
    viewDistance = 3 (27)

    customTheme {  (28)
        uri = 'https:/somewhere.example/there/is/a/revealjs/theme' (29)
        location = '/path/to/dir' (30)
        relativePath = 'my/theme' (31)
    }
}
1 Delay in milliseconds between automatically proceeding to the next slide. Disabled when set to 0 (the default). This value can still be overwritten on a per-slide basis by setting a data-autoslide attribute on a slide.
2 Stop auto-sliding after user input.
3 Transition style for full page slide backgrounds. One of none, fade, slide, convex, concave, or zoom. If not set then an internal default of FADE will be used.
4 Set the background transition via the enumeration instead.
5 Select a built-in theme. Unsets any custom theme.
6 Select a built-in theme using the enumeration instead. Unsets any custom theme.
7 Display controls in the bottom right corner.
8 Flags if the presentation is running in an embedded mode. (Contained within a limited portion of the screen).
9 Use fragments globally.
10 Hides the address bar on mobile devices.
11 Enable keyboard shortcuts for navigation.
12 Loop the presentation.
13 Enable slide navigation via mouse wheel.
14 Enable the slide overview mode.
15 Opens links in an iframe preview overlay.
16 Display a presentation progress bar.
17 Push each slide change to the browser history.
18 Change the presentation direction to be RTL.
19 Displays the slide number. Set via the RevealjsOptions.SlideNumber enumeration.
20 Displays the slide number. Set via a valid string.
21 Enables touch navigation on devices with touch input.
22 Transition style. If not set, an internal default of SLIDE will be used.
23 Set the transition style via the enumeration instead.
24 Slide transition speed. One of default, fast, or slow. If not provided, an internal default value of DEFAULT will be used.
25 Set the transition speed via the enumeration instead.
26 Vertical centering of slides.
27 Number of slides away from the current that are visible. If not set, an internal value of 3 will be used.
28 Configures a custom theme. Unsets any built-in theme.
29 Get the theme from a URL. Anything convertible to a URI can be passed.
30 Get a theme from the local filesystem. Anything convertible to a file can be used.
31 Get a theme from a path relative to the source directory. Anything convertible to a file can be used.