hugo/docs/layouts/_shortcodes/hl.html
Bjørn Erik Pedersen 61a286595e
Some checks are pending
Test / test (1.23.x, ubuntu-latest) (push) Waiting to run
Test / test (1.23.x, windows-latest) (push) Waiting to run
Test / test (1.24.x, ubuntu-latest) (push) Waiting to run
Test / test (1.24.x, windows-latest) (push) Waiting to run
Merge commit 'b3d87dd0fd'
2025-04-24 10:23:16 +02:00

14 lines
498 B
HTML

{{/* prettier-ignore-start */ -}}
{{- /*
Returns syntax-highlighted code from the given text.
This is useful as a terse way to highlight inline code snippets. Calling the
highlight shortcode for inline snippets is verbose.
@example This is {{< hl python >}}inline{{< /hl >}} code.
*/ -}}
{{/* prettier-ignore-end */ -}}
{{- $code := .Inner | strings.TrimSpace }}
{{- $lang := or (.Get 0) "go" }}
{{- $opts := dict "hl_inline" true "noClasses" true }}
{{- transform.Highlight $code $lang $opts }}