Skip to content

Configuration

kslides has three configuration scopes, each one overriding its parent:

  1. Globalkslides { presentationConfig { } }
  2. Presentationpresentation { presentationConfig { } }
  3. SlidemarkdownSlide { slideConfig { } } (and the same on htmlSlide / dslSlide)

Anything you don't set falls through to the next level up, then to the reveal.js defaults.

Cascading example

fun configCascade() {
  kslides {
    // 1. Global defaults — apply to every presentation
    presentationConfig {
      transition = Transition.SLIDE
      history = true
    }

    presentation {
      // 2. Presentation-level overrides
      presentationConfig {
        transition = Transition.FADE

        slideConfig {
          backgroundColor = "#1f1f1f"
        }
      }

      markdownSlide {
        // 3. Slide-level overrides
        slideConfig {
          backgroundColor = "#2A9EEE"
          transition = Transition.ZOOM
        }
        content { "# Cascading config" }
      }
    }
  }
}

The markdownSlide here ends up with transition = ZOOM (slide-level wins) on a #2A9EEE background, while every other slide in the deck would inherit the presentation's transition = FADE and #1f1f1f background.

Transitions

fun transitionsExample() {
  kslides {
    presentation {
      presentationConfig {
        transition = Transition.CONVEX
        transitionSpeed = Speed.FAST
      }
      markdownSlide { content { "# Convex transition" } }
      markdownSlide { content { "# Same transition applies here" } }
    }
  }
}

Available transitions: NONE, FADE, SLIDE, CONVEX, CONCAVE, ZOOM (see com.kslides.Transition).

reveal.js renders small nav links in the top corners. kslides exposes them as topLeftHref / topRightHref. Set to an empty string to hide them:

fun navHrefs() {
  kslides {
    presentation {
      presentationConfig {
        topLeftHref = "https://github.com/kslides/kslides"
        topRightHref = "" // disable the top-right link
      }
      markdownSlide { content { "# Navigation links" } }
    }
  }
}

Copy-code button

reveal.js can render a "Copy" button on every code block via the CopyCode plugin. Turn it on with enableCodeCopy, then tune it through copyCodeConfig { }:

fun copyCodeButton() {
  kslides {
    presentation {
      presentationConfig {
        enableCodeCopy = true // render the copy button on code blocks

        copyCodeConfig {
          display = CopyCodeDisplay.ICONS // TEXT (default), ICONS, or BOTH
          button = CopyCodeButton.HOVER // ALWAYS (default), HOVER, or FALSE to disable
          copy = "Copy"
          copied = "Copied!"
          timeout = 2000 // ms the "Copied!" label stays before reverting
          scale = 0.8 // em sizes take fractional values
        }
      }
      markdownSlide { content { "# Code blocks now show a copy button" } }
    }
  }
}

button (ALWAYS / HOVER / FALSE) and display (TEXT / ICONS / BOTH) are typed enums, so a mistyped value is a compile error. scale, offset, and radius are em values, so fractional numbers such as 0.8 are fine.

Nested config blocks

Some settings are grouped into their own blocks rather than sitting flat on presentationConfig { }:

Block Covers
customTheme { } Typed theme overrides — colors, fonts, heading treatment, corner logo. See Styling.
slideConfig { } Per-slide defaults: backgrounds, font sizes, reveal.js data-* options
menuConfig { } The reveal.js slide-menu plugin
copyCodeConfig { } The copy-to-clipboard button on code blocks
playgroundConfig { } Kotlin Playground iframe defaults
diagramConfig { } Kroki endpoint and diagram defaults
letsPlotIframeConfig{} Lets-Plot iframe defaults

output { } has one of its own: pdf { }, covering PDF export — output directory, page size, per-deck exclude(), and browser selection.

Favicon

kslides ships no icon of its own, so every page asks for favicon.ico at the output root unless you say otherwise:

presentationConfig {
  favicon = "images/icon.png"   // any path; the type hint follows the extension
  // favicon = ""               // emit no <link> at all
}

Supply the file at the output root for static output, or under src/main/resources/public/ for the HTTP server.

What can I configure?

The same DSL exposes every reveal.js setting (history, controls, progress bar, autoslide, …) and a number of kslides-managed extras (menu, copy-code button, code highlighting). Browse the source in com.kslides.config for the full list — every property is documented in-place.