code

.code   lang:{String? = null}
linenumbers:{Boolean = true}
focus:{Range? = null}
code:{EvaluableString}
-> Node

Creates a code block. Contrary to its standard Markdown implementation with backtick/tilde fences, this function accepts function calls within its code argument, hence it can be used - for example - in combination with read to load code from file.

Examples:

Load from file:

.code {kotlin} focus:{2..5}
.read {snippet.kt}

Load dynamically:

.function {mycode} {mylang}
source:
code {mylang}
.source

Parameters

lang

optional language of the code

linenumbers

whether to show line numbers

focus

range of lines to focus on. No lines are focused if unset. Supports open ranges. Note: HTML rendering requires linenumbers to be enabled.

code

code content