docs/content/en/content-management/syntax-highlighting.md
Hugo provides several methods to add syntax highlighting to code examples:
transform.Highlight function within your templateshighlight shortcode with any content formatIn its default configuration, Hugo highlights code examples within fenced code blocks, following this form:
```LANG [OPTIONS]
CODE
```
CODE : The code to highlight.
LANG : The language of the code to highlight. Choose from one of the supported languages. This value is case-insensitive.
OPTIONS : One or more space-separated or comma-separated key-value pairs wrapped in braces. Set default values for each option in your project configuration. The key names are case-insensitive.
For example, with this Markdown:
```go {linenos=inline hl_lines=[3,"6-8"] style=emacs}
package main
import "fmt"
func main() {
for i := 0; i < 3; i++ {
fmt.Println("Value of i:", i)
}
}
```
Hugo renders this:
package main
import "fmt"
func main() {
for i := 0; i < 3; i++ {
fmt.Println("Value of i:", i)
}
}
{{% include "_common/syntax-highlighting-options.md" %}}
When documenting shortcode usage, escape the tag delimiters:
```text {linenos=inline}
{{</*/* shortcode-1 */*/>}}
{{%/*/* shortcode-2 */*/%}}
```
Hugo renders this to:
{{</* shortcode-1 */>}}
{{%/* shortcode-2 */%}}
These are the supported languages. Use one of the identifiers, not the language name, when specifying a language for:
transform.Highlight functionhighlight shortcode{{< chroma-lexers >}}