File: hl.html

package info (click to toggle)
hugo 0.155.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 43,600 kB
  • sloc: javascript: 31,879; ansic: 2,350; xml: 350; makefile: 196; sh: 110
file content (14 lines) | stat: -rw-r--r-- 498 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{{/* 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 }}