mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'
This commit is contained in:
@@ -1,19 +1,15 @@
|
||||
---
|
||||
title: transform.HighlightCodeBlock
|
||||
description: Highlights code received in context within a code block render hook.
|
||||
categories: [functions]
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: functions
|
||||
function:
|
||||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/transform/CanHighlight
|
||||
- functions/transform/Highlight
|
||||
returnType: highlight.HighlightResult
|
||||
signatures: ['transform.HighlightCodeBlock CONTEXT [OPTIONS]']
|
||||
relatedFunctions:
|
||||
- transform.CanHighlight
|
||||
- transform.Highlight
|
||||
- transform.HighlightCodeBlock
|
||||
---
|
||||
|
||||
This function is only useful within a code block render hook.
|
||||
@@ -26,7 +22,6 @@ Given the context passed into a code block render hook, `transform.HighlightCode
|
||||
.Inner
|
||||
: (`template.HTML`) Returns highlighted code without any wrapping elements, allowing you to create your own wrapper.
|
||||
|
||||
|
||||
```go-html-template
|
||||
{{ $result := transform.HighlightCodeBlock . }}
|
||||
{{ $result.Wrapped }}
|
||||
@@ -35,8 +30,8 @@ Given the context passed into a code block render hook, `transform.HighlightCode
|
||||
To override the default [highlighting options]:
|
||||
|
||||
```go-html-template
|
||||
{{ $options := merge .Options (dict "linenos" true) }}
|
||||
{{ $result := transform.HighlightCodeBlock . $options }}
|
||||
{{ $opts := merge .Options (dict "linenos" true) }}
|
||||
{{ $result := transform.HighlightCodeBlock . $opts }}
|
||||
{{ $result.Wrapped }}
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user