Debian Codegraph @

docs/content/en/quick-reference/syntax-highlighting-styles.md

raw
1 ---
2 title: Syntax highlighting styles
3 description: Highlight code examples using one of these styles.
4 categories: []
5 keywords: [highlight]
6 ---
7
8 ## Overview
9
10 Hugo provides several methods to add syntax highlighting to code examples:
11
12 - Use the [`transform.Highlight`][] function within your templates
13 - Use the [`highlight`][] shortcode with any [content format](g)
14 - Use [fenced code blocks][] with the Markdown content format
15
16 Regardless of method, use any of the syntax highlighting styles below.
17
18 Set the default syntax highlighting style in your project configuration:
19
20 {{< code-toggle file=hugo >}}
21 [markup.highlight]
22 style = 'monokai'
23 {{< /code-toggle >}}
24
25 See [configure Markup][].
26
27 ## Styles
28
29 This gallery demonstrates the application of each syntax highlighting style with code examples written in different programming languages.
30
31 {{% syntax-highlighting-styles %}}
32
33 [`highlight`]: /shortcodes/highlight/
34 [`transform.Highlight`]: /functions/transform/highlight/
35 [configure Markup]: /configuration/markup/#highlight
36 [fenced code blocks]: /content-management/syntax-highlighting/#fenced-code-blocks