code
.code lang:{String? = null}
linenumbers:{Boolean = true}
focus:{Range? = null}
code:{EvaluableString}
-> Node
Content copied to clipboard
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.
Example of a code block loaded from file via read:
.code {kotlin} focus:{2..5}
.read {snippet.kt}
Content copied to clipboard
Parameters
lang
- Optional
- Likely named
optional language of the code
linenumbers
- Optional
- Likely named
whether to show line numbers
focus
- Optional
- Likely named
range of lines to focus on. No lines are focused if unset. Supports open ranges. Note: HTML rendering requires linenumbers to be enabled.
code
- Likely a body argument
code content