mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
---
|
||||
title: Syntax highlighting styles
|
||||
description: Highlight code examples using one of these styles.
|
||||
categories: []
|
||||
keywords: [highlight]
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Hugo provides several methods to add syntax highlighting to code examples:
|
||||
|
||||
- Use the [`transform.Highlight`] function within your templates
|
||||
- Use the [`highlight`] shortcode with any [content format](g)
|
||||
- Use fenced code blocks with the Markdown content format
|
||||
|
||||
Regardless of method, use any of the syntax highlighting styles below.
|
||||
|
||||
Set the default syntax highlighting style in your site configuration:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[markup.highlight]
|
||||
style = 'monokai'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
See [configure Markup](/configuration/markup/#highlight).
|
||||
|
||||
[`transform.Highlight`]: /functions/transform/highlight/
|
||||
[`highlight`]: /shortcodes/highlight/
|
||||
[fenced code blocks]: /content-management/syntax-highlighting/#fenced-code-blocks
|
||||
|
||||
## Styles
|
||||
|
||||
This gallery demonstrates the application of each syntax highlighting style with code examples written in different programming languages.
|
||||
|
||||
{{% syntax-highlighting-styles %}}
|
Reference in New Issue
Block a user