diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-05-26 12:17:10 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-06-14 14:08:40 +0200 |
commit | 35fa192838ecfa244335fca957e55d3956a48665 (patch) | |
tree | 7a1dac873c8c219d0ca933aa2a36891d92764302 /helpers | |
parent | 09ac73338198ceb143c1e5edc5859ab735cd80bb (diff) | |
download | hugo-35fa192838ecfa244335fca957e55d3956a48665.tar.gz hugo-35fa192838ecfa244335fca957e55d3956a48665.zip |
deps: Udpate to github.com/alecthomas/chroma/v2
Fixes #9932
Fixes #9931
Diffstat (limited to 'helpers')
-rw-r--r-- | helpers/docshelper.go | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/helpers/docshelper.go b/helpers/docshelper.go index e7c7fbe5b..35d07d366 100644 --- a/helpers/docshelper.go +++ b/helpers/docshelper.go @@ -1,11 +1,9 @@ package helpers import ( - "path/filepath" "sort" - "strings" - "github.com/alecthomas/chroma/lexers" + "github.com/alecthomas/chroma/v2/lexers" "github.com/gohugoio/hugo/docshelper" ) @@ -14,33 +12,18 @@ func init() { docsProvider := func() docshelper.DocProvider { var chromaLexers []any - sort.Sort(lexers.Registry.Lexers) + sort.Sort(lexers.GlobalLexerRegistry.Lexers) - for _, l := range lexers.Registry.Lexers { + for _, l := range lexers.GlobalLexerRegistry.Lexers { config := l.Config() - var filenames []string - filenames = append(filenames, config.Filenames...) - filenames = append(filenames, config.AliasFilenames...) - - aliases := config.Aliases - - for _, filename := range filenames { - alias := strings.TrimSpace(strings.TrimPrefix(filepath.Ext(filename), ".")) - if alias != "" { - aliases = append(aliases, alias) - } - } - - aliases = UniqueStringsSorted(aliases) - lexerEntry := struct { Name string Aliases []string }{ config.Name, - aliases, + config.Aliases, } chromaLexers = append(chromaLexers, lexerEntry) |