Repository: gohugoio/hugo (language: go)

Issue:
Regression: transform.Highlight not working with delimit
<!-- Please answer these questions before submitting your issue. Thanks! -->

### What version of Hugo are you using (`hugo version`)?

<pre>
$ hugo version
hugo v0.93.0-07469082+extended linux/amd64 BuildDate=2022-02-28T08:30:42Z VendorInfo=gohugoio
</pre>

### Does this issue reproduce with the latest release?
Yes

### Description

After updating to 0.93.0 I need to cast the result of `delimit` to string when passing to `transform.Highlight`.

The following shortcode should highlight the 4th line in each code block. This works in 0.92.2. In 0.93.0 the second code block seems to ignore the passed options.
```
{{ $options := "hl_lines=4" }}
{{ transform.Highlight .Inner "go" $options }}
{{ $optionsSlice := slice "hl_lines=4" }}
{{ transform.Highlight .Inner "go" (delimit $optionsSlice ",") }}
{{ transform.Highlight .Inner "go" (string (delimit $optionsSlice ",")) }}
```




Discussion / hints:

Fix patch:
diff --git a/markup/highlight/config.go b/markup/highlight/config.go
index 3204ce195dc..1142c5e1147 100644
--- a/markup/highlight/config.go
+++ b/markup/highlight/config.go
@@ -122,10 +122,13 @@ func applyOptions(opts interface{}, cfg *Config) error {
 	switch vv := opts.(type) {
 	case map[string]interface{}:
 		return applyOptionsFromMap(vv, cfg)
-	case string:
-		return applyOptionsFromString(vv, cfg)
+	default:
+		s, err := cast.ToStringE(opts)
+		if err != nil {
+			return err
+		}
+		return applyOptionsFromString(s, cfg)
 	}
-	return nil
 }
 
 func applyOptionsFromString(opts string, cfg *Config) error {


Test patch:
diff --git a/tpl/transform/transform_test.go b/tpl/transform/transform_test.go
index 289674bf176..e52e0046dfb 100644
--- a/tpl/transform/transform_test.go
+++ b/tpl/transform/transform_test.go
@@ -15,6 +15,7 @@ package transform_test
 
 import (
 	"html/template"
+	"strings"
 	"testing"
 
 	"github.com/gohugoio/hugo/common/loggers"
@@ -81,6 +82,8 @@ func TestHighlight(t *testing.T) {
 		// Issue #4179
 		{`<Foo attr=" &lt; "></Foo>`, "xml", "", `&amp;lt;`},
 		{tstNoStringer{}, "go", "", false},
+		// Issue #9591
+		{strings.Repeat("AAA	\n", 10), "bash", template.HTML("linenos=true,noClasses=false"), "line"},
 	} {
 
 		result, err := ns.Highlight(test.s, test.lang, test.opts)