summaryrefslogtreecommitdiffstats
path: root/markup/highlight
diff options
context:
space:
mode:
Diffstat (limited to 'markup/highlight')
-rw-r--r--markup/highlight/chromalexers/chromalexers.go2
-rw-r--r--markup/highlight/highlight.go12
-rw-r--r--markup/highlight/highlight_test.go1
-rw-r--r--markup/highlight/integration_test.go2
4 files changed, 3 insertions, 14 deletions
diff --git a/markup/highlight/chromalexers/chromalexers.go b/markup/highlight/chromalexers/chromalexers.go
index 41fd76261..6ab4a7bbe 100644
--- a/markup/highlight/chromalexers/chromalexers.go
+++ b/markup/highlight/chromalexers/chromalexers.go
@@ -1,4 +1,4 @@
-// Copyright 2022 The Hugo Authors. All rights reserved.
+// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/markup/highlight/highlight.go b/markup/highlight/highlight.go
index 85ea74124..a284b5981 100644
--- a/markup/highlight/highlight.go
+++ b/markup/highlight/highlight.go
@@ -27,7 +27,6 @@ import (
"github.com/alecthomas/chroma/v2/styles"
"github.com/gohugoio/hugo/common/hugio"
"github.com/gohugoio/hugo/common/text"
- "github.com/gohugoio/hugo/identity"
"github.com/gohugoio/hugo/markup/converter/hooks"
"github.com/gohugoio/hugo/markup/highlight/chromalexers"
"github.com/gohugoio/hugo/markup/internal/attributes"
@@ -146,13 +145,6 @@ func (h chromaHighlighter) IsDefaultCodeBlockRenderer() bool {
return true
}
-var id = identity.NewPathIdentity("chroma", "highlight")
-
-// GetIdentity is for internal use.
-func (h chromaHighlighter) GetIdentity() identity.Identity {
- return id
-}
-
// HighlightResult holds the result of an highlighting operation.
type HighlightResult struct {
innerLow int
@@ -188,7 +180,7 @@ func highlight(fw hugio.FlexiWriter, code, lang string, attributes []attributes.
if lexer == nil {
if cfg.Hl_inline {
- fmt.Fprint(w, fmt.Sprintf("<code%s>%s</code>", inlineCodeAttrs(lang), gohtml.EscapeString(code)))
+ fmt.Fprintf(w, "<code%s>%s</code>", inlineCodeAttrs(lang), gohtml.EscapeString(code))
} else {
preWrapper := getPreWrapper(lang, w)
fmt.Fprint(w, preWrapper.Start(true, ""))
@@ -278,8 +270,6 @@ func (p *preWrapper) Start(code bool, styleAttr string) string {
}
func inlineCodeAttrs(lang string) string {
- if lang == "" {
- }
return fmt.Sprintf(` class="code-inline language-%s"`, lang)
}
diff --git a/markup/highlight/highlight_test.go b/markup/highlight/highlight_test.go
index 662f07c93..732dbfa64 100644
--- a/markup/highlight/highlight_test.go
+++ b/markup/highlight/highlight_test.go
@@ -87,7 +87,6 @@ User-Agent: foo
result, _ := h.Highlight(lines, "bash", "")
c.Assert(result, qt.Contains, "<span class=\"lnt\" id=\"2\"><a class=\"lnlinks\" href=\"#2\">2</a>\n</span>")
- result, _ = h.Highlight(lines, "bash", "lineanchors=test")
result, _ = h.Highlight(lines, "bash", "anchorlinenos=false,hl_lines=2")
c.Assert(result, qt.Not(qt.Contains), "id=\"2\"")
})
diff --git a/markup/highlight/integration_test.go b/markup/highlight/integration_test.go
index ce6705f02..b53b585c0 100644
--- a/markup/highlight/integration_test.go
+++ b/markup/highlight/integration_test.go
@@ -1,4 +1,4 @@
-// Copyright 2022 The Hugo Authors. All rights reserved.
+// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.