/reveal-kt

Kotlin wrapper for Reveal JS with CLI

Primary LanguageKotlinMIT LicenseMIT

RevealKt

CI GitHub last commit GitHub Maven Central

Kotlin DSL wrapper around Reveal JS presentation library

Usage

Run server with presentation:

jbang revealkt@limebeck.dev run ./MyAwesomePresentation.reveal.kts

Bundle presentation to static html site:

jbang revealkt@limebeck.dev bundle ./MyAwesomePresentation.reveal.kts

Render presentation to pdf via playwright:

jbang revealkt@limebeck.dev pdf ./MyAwesomePresentation.reveal.kts -o myPresentation.pdf

Caution

For now playwright requires to download chromium first (uses npm)

Playwright documentation: https://playwright.dev/java/docs/browsers

jbang revealkt@limebeck.dev chrome install

Uninstall chrome

jbang revealkt@limebeck.dev chrome uninstall

Create new presentation from template

jbang revealkt@limebeck.dev init my-awesome-presentation
cd ./my-awesome-presentation
jbang revealkt@limebeck.dev run ./presentation/my-awesome-presentation.reveal.kts

Add alias for revealkt

jbang app install revealkt@limebeck.dev
revealkt run ./presentation/my-awesome-presentation.reveal.kts

Example

MyAwesomeScript.reveal.kts:

import qrcode.color.Colors

title = "My awesome presentation"

configuration {
    controls = false
    progress = false
}

slides {
    regularSlide {
        autoanimate = true
        +title { "Hello from my awesome presentation" }
    }
    regularSlide {
        autoanimate = true
        +qrCode("https://github.com/LimeBeck/reveal-kt") {
            stretch = true
            transformBuilder {
                val logo = loadAsset("logo2.png")
                it.withSize(20).withColor(Colors.css("#B125EA")).withLogo(logo, 150, 150, clearLogoArea = true)
            }
        }
    }
    verticalSlide {
        val title = Title { "Some text" }
        slide {
            autoanimate = true
            +title
            +note {
                "Some note"
            }
        }
        slide {
            autoanimate = true
            +title
            +title { "Updated text" }
            +note {
                "Some note"
            }
        }
        slide {
            autoanimate = true
            +title
            +code {
                //language=JSON
                """
                   {
                    "string": "some string"
                   } 
                """.trimIndent()
            }
        }
        slide {
            +img(src = "image.png") {
                stretch = true
            }
        }
    }
}