I wonder if we could do what Dokka does for extern...
# storyboard
j
I wonder if we could do what Dokka does for external files ... point it at a real
.kt
file that compiles, and snip out the part I want. This is going to be a lot of configuration complexity! But I could be confident that my code samples really build, and maybe even sync with the presentation?
b
I've experimented with this a little as well. • Gradle task to extract code from a project: https://github.com/bnorm/deck.bnorm.dev/blob/main/buildSrc/src/main/kotlin/dev/bnorm/gradle/sample/extraction/SampleExtraction.kt • Configuration: https://github.com/bnorm/deck.bnorm.dev/blob/main/kotlinconf2025/story/build.gradle.kts#L60-L73 • I use it to validate the code samples I have match the actual project code (on desktop only): https://github.com/bnorm/deck.bnorm.dev/blob/main/kotlinconf2025/story/src/commonMain/kotlin/dev/bnorm/kc25/components/Samples.kt I do it this way because I often want to reveal parts of the sample code in some order, so I use some fun text tagging stuff to manipulate code samples. https://github.com/bnorm/deck.bnorm.dev/blob/main/kotlinconf2025/story/src/commonMain/kotlin/dev/bnorm/kc25/sections/register/FirRegistrar.kt#L[…]59
j
oooooh thank you