Configuration¶
kslides has three configuration scopes, each one overriding its parent:
- Global —
kslides { presentationConfig { } } - Presentation —
presentation { presentationConfig { } } - Slide —
markdownSlide { slideConfig { } }(and the same onhtmlSlide/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).
Top-corner navigation links¶
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.
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.