Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'

This commit is contained in:
Bjørn Erik Pedersen
2023-12-04 15:24:01 +01:00
810 changed files with 24147 additions and 7766 deletions

View File

@@ -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 }}
```