From 2db43f841c7d2db0edcb3a3478c0833c38ae5997 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Tue, 31 Dec 2024 08:35:22 -0500 Subject: [PATCH] markup/highlight: Remove noHl option Closes #9885 --- markup/highlight/config.go | 6 ------ markup/highlight/highlight.go | 2 +- markup/internal/attributes/attributes.go | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/markup/highlight/config.go b/markup/highlight/config.go index 338ea77e5..b19e9ec1b 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 30f225c0b..ee07fb9ad 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 9c147f766..b2d4a5ed6 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, }