asciidoctor-reveal.js
repository·main·Indexed 43 days ago
https://github.com/asciidoctor/asciidoctor-reveal.jsA reveal.js converter for Asciidoctor.js (version 6.0.0-beta.2) that transforms AsciiDoc documents into HTML5 presentations. It provides a CLI tool, a JavaScript API, and support for custom CSS, docinfo injection, speaker notes, and metadata attributes for source code, checklists, quotes, STEM blocks, and media.
What's inside asciidoctor-reveal.js
- Asciidoctor reveal.js is a converter designed for Asciidoctor and Asciidoctor.js. It transforms AsciiDoc documents into HTML5 presentations using the reveal.js framework. It supports multiple technology stacks for conversion, including Ruby, Node.js (Asciidoctor.js), Standalone Executables, and AsciidoctorJ (JVM/Maven).
Use a CDN for reveal.js instead of a local installation
mainTo avoid managing a local
reveal.jsdirectory, you can point the:revealjsdir:attribute to a CDN like jsDelivr.Warning:
- The presentation will require an active internet connection to load.
- Speaker notes will be served as plain text instead of HTML due to jsDelivr security restrictions, meaning they will not function correctly.
Example attribute usage:
:revealjsdir: https://cdn.jsdelivr.net/npm/reveal.jsBest practices and gotchas for rate limiting
mainWhen implementing rate limiters, keep the following considerations in mind:
Common Gotchas
- Off-by-one errors: Watch the edges of the refill window.
- Clamping: Always clamp the token count at the defined
capacityto prevent infinite accumulation. - Scope: Avoid the mistake of sharing a single bucket across every client; rate limiting should typically be scoped (e.g.,
per_client). - Persistence: Ensure bucket state is persisted across service restarts or deployments.
Critical Warnings
- Clock Drift: In distributed systems, do not rely on a single
Date.now()call across different replicas, as clocks will drift. - Burst Allowance: A limiter with zero burst allowance may reject legitimate traffic spikes.
Implementation Tips
- Client Communication: Return a
Retry-Afterheader so well-behaved clients can implement back-off logic instead of repeatedly hammering the API. - Monitoring: Monitor your
429(Too Many Requests) error rates rather than just standard5xxerrors.
Customize the title slide background and visual properties
mainThe converter allows you to apply visual customizations specifically to the title slide, such as background colors, images, videos, iframes, or transitions.
To use these settings, you must adapt the standard reveal.js
data-attributes by replacing thedata-prefix withtitle-slide-. For example, to set a background image, use thetitle-slide-imageattribute instead ofdata-background-image.Create vertical slides
mainVertical slides are created by nesting sections. When a slide contains sub-sections (e.g.,
=== Sub-section), reveal.js renders the sub-sections vertically below the parent slide.== Slide 6 Top slide === Slide 6.1 This is a vertical sub-slideHow steps and fragments work in reveal.js
mainSteps (known as
fragmentsin reveal.js) allow you to highlight or incrementally reveal individual elements on a slide. Every element assigned thefragmentrole or thestepoption will be revealed one-by-one during the presentation sequence before moving to the next slide.Recommendation: While you can use the
fragmentrole on any element, it is recommended to use thestepoption to declare a fragment. This ensures better portability and avoids CSS conflicts when using other Asciidoctor converters.== Topic [%step] * this * is * revealed * graduallyCustomize Aurora theme using design tokens
mainAurora is built using CSS custom properties (design tokens). You can rebrand the entire presentation by overriding these tokens in a
:customcss:file or by editingaurora.cssdirectly.Key token categories include:
- Palette: Colors like
--aurora-bg,--aurora-surface,--aurora-ink, and semantic colors like--aurora-coral(caution) or--aurora-lime(tip). - Type: Font families for display (
--aurora-font-display), body (--aurora-font-body), and code (--aurora-font-code). - Shape: Radius values like
--aurora-radiusand shadow settings. - reveal.js Tokens: Aurora also maps its tokens to standard reveal.js
--r-*properties.
- Palette: Colors like
Configure Auto Animate settings
mainAuto-animate settings are configured using Asciidoctor attributes and options, which are mapped to HTML
data-*attributes.- Boolean settings: Use Asciidoctor options (e.g.,
%auto-animate). - Value-based settings: Use Asciidoctor attributes (e.g.,
auto-animate-easing=ease-in-out).
- Boolean settings: Use Asciidoctor options (e.g.,
Use :notitle: to suppress the title slide
mainIn v6, the:notitle:attribute now correctly suppresses the title slide. If you have:notitle:set in your document and wish to see a title slide, you must remove this attribute.Understand footnote numbering behavior
mainInasciidoctor-reveal.jspresentations, footnote numbering is scoped to the individual slide. The numbering will reset to 1 at the start of every new slide.Use slide-header and slide-footer for repeated content
mainBecause
slide-headerandslide-footerare inserted into the<section>of every slide (both horizontal and vertical), they are best used for content that should appear on every slide, such as:- A running footer with a URL or license notice.
- A per-slide watermark.
- Consistent branding elements.
Compare revealjs_theme, revealjs_customtheme, and customcss
mainThe appearance of a presentation can be controlled at three different levels of specificity using these attributes:
:revealjs_theme:: Selects a built-in, ready-made stylesheet provided by reveal.js (e.g.,black,white,league). This is the base layer.:revealjs_customtheme:: Replaces the built-in theme entirely with a file or URL of your own. Use this when you are authoring or reusing a complete, standalone theme.:customcss:: Adds an extra stylesheet on top of the active theme (built-in or custom). It is loaded after the theme, making it ideal for small tweaks like adjusting margins or colors for a single presentation.