docs/layouts/_shortcodes/hl.html
raw| 1 | {{/* |
| 2 | Returns syntax-highlighted code from the given text. |
| 3 | |
| 4 | This is useful as a terse way to highlight inline code snippets. Calling the |
| 5 | highlight shortcode for inline snippets is verbose. |
| 6 | |
| 7 | @example This is {{< hl python >}}inline{{< /hl >}} code. |
| 8 | */}} |
| 9 | |
| 10 | {{- $code := .Inner | strings.TrimSpace }} |
| 11 | {{- $lang := or (.Get 0) "go" }} |
| 12 | {{- $opts := dict "hl_inline" true "noClasses" true }} |
| 13 | {{- transform.Highlight $code $lang $opts }} |