KSlides

Root orchestrator for a set of presentations. Instances are not meant to be constructed directly — use the kslides top-level function instead, which applies the DSL block and then triggers the configured output modes.

Holds global configuration (kslidesConfig, presentationConfig, output), shared CSS (css), and the collection of Presentation definitions produced by each presentation block. Also caches iframe and Kroki content so repeated lookups from the Ktor server do not re-execute expensive content generators.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Global CSS applied to every Presentation in this KSlides. Appended to via the css DSL block or via css += "..." / css += { ... }.

Link copied to clipboard

The output configuration populated by the output {} block. Public so that tooling built on buildKSlides (e.g. kslides-export) can read it after the DSL has been evaluated.

Link copied to clipboard

The URL paths of all registered presentations (e.g. "/", "/demo.html"), in declaration order. Populated once buildKSlides/kslides has evaluated the DSL. Public for tooling (e.g. kslides-export) that iterates the presentations served by startHttpServer.

Functions

Link copied to clipboard
open override fun close()

Release the lazily-created Ktor HttpClient if it was ever initialized (it is created only when a diagram{} block POSTs to Kroki). filesystem-only runs close it automatically once slides are written; HTTP mode keeps it alive for the server's lifetime. Idempotent and safe to call when the client was never created. Lets consumers use kslides { … } results with .use { }.

Link copied to clipboard
fun css(block: CssBuilder.() -> Unit)

Append CSS (declared via Kotlin's CSS DSL) to the global stylesheet that is injected into every generated presentation page.

Link copied to clipboard
fun kslidesConfig(block: KSlidesConfig.() -> Unit)

Configure values that apply to all presentations (e.g. static asset roots, Playground URL, Kroki URL, Lets-Plot JS version, HTTP client timeout). The block is evaluated after the full kslides {} DSL so that later kslidesConfig{} calls override earlier ones.

Link copied to clipboard
fun output(block: OutputConfig.() -> Unit)

Configure how the presentations are emitted: filesystem mode (enableFileSystem), HTTP mode (enableHttp), output directory, HTTP port, etc.

Link copied to clipboard
fun presentation(block: Presentation.() -> Unit)

Register a Presentation definition. Each call adds one entry; the path assigned inside the block determines its URL (HTTP mode) or output filename (filesystem mode).

Link copied to clipboard

Default PresentationConfig applied to every Presentation. Per-presentation overrides take precedence; see the configuration-cascade description in the project README.

Link copied to clipboard
fun startHttpServer(port: Int = outputConfig.port, wait: Boolean = false): KSlidesHttpServer

Start the same Ktor HTTP server that output { enableHttp = true } runs, serving every registered presentation plus the bundled static assets. When com.kslides.config.OutputConfig.followAlong is enabled, the presenter URLs (with the token) are logged against the actual bound port.