Repository: gohugoio/hugo (language: go)

Issue:
highlightling: Remove noHl (which has undefined behaviour)
<!-- Please answer these questions before submitting your issue. Thanks! -->

### What version of Hugo are you using (`hugo version`)?

<pre>
$ hugo version
0.95
</pre>

### Does this issue reproduce with the latest release?

I am using the docker version, so waiting for https://github.com/klakegg/docker-hugo/pull/64 to be merged

### Problem

Based on https://github.com/wowchemy/wowchemy-hugo-themes/issues/2708, we observed 

> `<span>` instances are being inserted by Hugo which we would assume shouldn't happen when Hugo is configured with `noHl: true`. It's either a Hugo bug with the `noHl` option or there's an opportunity for Hugo team to allow the Hugo code block parser to be used to detect Mermaid diagram code blocks without highlighting any code or injecting any `<span>`.

The `<span>` instances being inserted cause rendering issues for code blocks in markdown slides.


Discussion / hints:
I must admit that I don't know what `noHl` was meant to mean. I suspect it was something we dragged over from Pygments. Maybe @jmooring  could shed some light on this, but currently 

If hl=true:

1. If you have a known lang/lexer, we always highlights
2. Else, we just wrap the code in a `pre`.
> I don't know what noHl was meant to mean

Same here, but I do know that the behavior changed a bit when we removed <https://github.com/yuin/goldmark-highlighting> in v0.93.0.

This option/attribute has never been documented, other than its presence in docs.json. If it were up to me, I'd remove the option and see what breaks in the wild.

@hofbi I understand that the action suggested above does not solve your issue.

Fix patch:
diff --git a/markup/highlight/config.go b/markup/highlight/config.go
index 338ea77e502..b19e9ec1b00 100644
--- a/markup/highlight/config.go
+++ b/markup/highlight/config.go
@@ -33,7 +33,6 @@ const (
 	lineNosKey     = "linenos"
 	hlLinesKey     = "hl_lines"
 	linosStartKey  = "linenostart"
-	noHlKey        = "nohl"
 )
 
 var DefaultConfig = Config{
@@ -60,9 +59,6 @@ type Config struct {
 	// Use inline CSS styles.
 	NoClasses bool
 
-	// No highlighting.
-	NoHl bool
-
 	// When set, line numbers will be printed.
 	LineNos            bool
 	LineNumbersInTable bool
@@ -234,8 +230,6 @@ func normalizeHighlightOptions(m map[string]any) {
 
 	for k, v := range m {
 		switch k {
-		case noHlKey:
-			m[noHlKey] = cast.ToBool(v)
 		case lineNosKey:
 			if v == "table" || v == "inline" {
 				m["lineNumbersInTable"] = v == "table"
diff --git a/markup/highlight/highlight.go b/markup/highlight/highlight.go
index 30f225c0b2f..ee07fb9ad79 100644
--- a/markup/highlight/highlight.go
+++ b/markup/highlight/highlight.go
@@ -168,7 +168,7 @@ func highlight(fw hugio.FlexiWriter, code, lang string, attributes []attributes.
 		lexer = chromalexers.Get(lang)
 	}
 
-	if lexer == nil && (cfg.GuessSyntax && !cfg.NoHl) {
+	if lexer == nil && cfg.GuessSyntax {
 		lexer = lexers.Analyse(code)
 		if lexer == nil {
 			lexer = lexers.Fallback
diff --git a/markup/internal/attributes/attributes.go b/markup/internal/attributes/attributes.go
index 9c147f76693..b2d4a5ed6e3 100644
--- a/markup/internal/attributes/attributes.go
+++ b/markup/internal/attributes/attributes.go
@@ -36,7 +36,6 @@ var chromaHighlightProcessingAttributes = map[string]bool{
 	"lineNoStart":        true,
 	"lineNumbersInTable": true,
 	"noClasses":          true,
-	"nohl":               true,
 	"style":              true,
 	"tabWidth":           true,
 }


Test patch: