Include runnable Kotlin code snippets in your WordPress posts

JetBrains offers a great online environment, Kotlin playground, where you can play around and share Kotlin code fragments. This environment offers an option to embed code fragments from the Kotlin Playground into your website using an iframe. This does not always play nicely with WordPress. Luckily there is a WordPress plugin available that allows for including runnable Kotlin code into your WordPress posts.

Tip from our side, try to edit in text mode only, we noticed that indentation is being stripped from the code snippets when using this plugin in the visual editor, which is rather annoying. You could also revert back to the classic editor in WordPress. See this github ticket for more details:

Try the example below yourself:

The plugin can be downloaded from the Kotlin github page: 

Did you enjoy this content? We have got more on the way! Sign up here for regular updates!

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *