Skip to content

Provides support for using the Kotlin Playground with mkdocs-material

License

Notifications You must be signed in to change notification settings

twangodev/mkdocs-kotlin-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mkdocs-kotlin-playground

Replaces fenced kotlin code blocks with an themed and interactive Kotlin Playground.

Usage

First, copy kotlin.js and kotlin.css into the respective javascripts and stylesheets directories in your mkdocs project.

Note: The javascripts and stylesheets directories should be in your ./docs/ directory.

Next add the following to your mkdocs.yml:

extra_javascript:
  - javascripts/kotlin.js
  - https://unpkg.com/kotlin-playground@1
  
extra_css:
    - stylesheets/kotlin.css

This plugin activates the Kotlin Playground for all fenced code blocks with the language kotlin.

Extra Features

Kotlin Playground Options

//sampleStart and //sampleEnd

You can use //sampleStart and //sampleEnd to specify a range of lines to be shown in the Kotlin Playground. This is useful if you want to show a small snippet of code in the documentation, but want to allow users to edit the entire file.

For example, to show the contents of the main function in the Kotlin Playground:

fun myHiddenFunction() {
    println("mystery")
}

fun main() {
//sampleStart
    println("Hello World!")
    myHiddenFunction()
//sampleEnd
}

About

Provides support for using the Kotlin Playground with mkdocs-material

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages