{{- /* Renders syntax highlighted code. @param {bool} [copy=true] If true, display a copy to clipboard button. @param {string} [file] The file name to display above the rendered code. @param {string} [lang] The code language of the inner content. @returns {template.HTML} */}} {{- /* Initialize. */}} {{- $copy := true }} {{- $file := " " }} {{- $lang := "" }} {{- /* Get parameters. */}} {{- $file = .Get "file" }} {{- $lang = or (.Get "lang") (path.Ext $file | strings.TrimPrefix ".") "text" }} {{- if in (slice "false" false 0) (.Get "copy") }} {{- $copy = false }} {{- else if in (slice "true" true 1) (.Get "copy")}} {{- $copy = true }} {{- end }} {{- /* Use the go-html-template Chroma lexer for HTML. */}} {{- if eq $lang "html" }} {{- $lang = "go-html-template" }} {{- end }} {{- /* Render. */}}