Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hugo shortcode for Kotlin Playground
<script src="https://unpkg.com/kotlin-playground@1" data-selector=".kotlin-code"></script>
<!-- kotlin -->
<code class="language-kotlin kotlin-code"
{{- if .Get "compilerVersion" }}data-version="{{ .Get "compilerVersion" }}"{{ end -}}
{{- if .Get "foldedButton" }}folded-button="{{ .Get "foldedButton" }}"{{ end -}}
{{- if .Get "height" }}data-output-height="{{ .Get "height" }}"{{ end -}}
{{- if .Get "highlightOnly" }}data-highlight-only{{ end -}}
{{- if .Get "jsLibs" }}data-js-libs="{{ .Get "jsLibs" }}"{{ end -}}
{{- if .Get "targetPlatform" }}data-target-platform="{{ .Get "targetPlatform" }}"{{ end -}}
{{- if .Get "theme" }}theme="{{ .Get "theme" }}"{{ end -}}
>{{htmlUnescape .Inner}}</code>
<!-- /kotlin -->
@hakimrie

This comment has been minimized.

Copy link

hakimrie commented Jun 19, 2020

thank you for the gist.
I want to ask, how to make hugo to not strip out tag/edge bracket?

for example this code

{{ <kotlin> }}
fun main(args: Array<String>) {
    println("Hello, World!")
}
{{ </kotlin> }}

will result:

fun main(args: Array) {
    println("Hello, World!")
}

because <String> it removed (by hugo)

update: never mind {{htmlUnescape .Inner}} solve the bug

@kpavlov

This comment has been minimized.

Copy link
Owner Author

kpavlov commented Jul 9, 2020

Thanks @hakimrie, gist updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.