Skip to content

Instantly share code, notes, and snippets.

Last active July 9, 2020 20:32
What would you like to do?
Hugo shortcode for Kotlin Playground
<script src="" 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 -->
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

Copy link

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