asciidoctor-reveal.js

repository·main·Indexed 43 days ago

https://github.com/asciidoctor/asciidoctor-reveal.js

A 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.

Tokens
25.5K
Snippets
105
Records
141
Agent score
52%

What's inside asciidoctor-reveal.js

  1. Use a CDN for reveal.js instead of a local installation

    main

    To avoid managing a local reveal.js directory, 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.js
  2. Best practices and gotchas for rate limiting

    main

    When 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 capacity to 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-After header 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 standard 5xx errors.
  3. Customize the title slide background and visual properties

    main

    The 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 the data- prefix with title-slide-. For example, to set a background image, use the title-slide-image attribute instead of data-background-image.

  4. How steps and fragments work in reveal.js

    main

    Steps (known as fragments in reveal.js) allow you to highlight or incrementally reveal individual elements on a slide. Every element assigned the fragment role or the step option will be revealed one-by-one during the presentation sequence before moving to the next slide.

    Recommendation: While you can use the fragment role on any element, it is recommended to use the step option to declare a fragment. This ensures better portability and avoids CSS conflicts when using other Asciidoctor converters.

    == Topic
    
    [%step]
    * this
    * is
    * revealed
    * gradually
  5. Customize Aurora theme using design tokens

    main

    Aurora is built using CSS custom properties (design tokens). You can rebrand the entire presentation by overriding these tokens in a :customcss: file or by editing aurora.css directly.

    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-radius and shadow settings.
    • reveal.js Tokens: Aurora also maps its tokens to standard reveal.js --r-* properties.
  6. Compare revealjs_theme, revealjs_customtheme, and customcss

    main

    The appearance of a presentation can be controlled at three different levels of specificity using these attributes:

    1. :revealjs_theme:: Selects a built-in, ready-made stylesheet provided by reveal.js (e.g., black, white, league). This is the base layer.
    2. :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.
    3. :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.