summaryrefslogtreecommitdiffstats
path: root/markup/highlight
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-17 22:03:27 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-17 22:03:27 +0100
commitb80853de90b10171155b8f3fde47d64ec7bfa0dd (patch)
tree435d3dbf7a495a0c6ce64c9769e037179aa0d27b /markup/highlight
parent423594e03a906ef4150f433666ff588b022c3c92 (diff)
all: gofmt -w -r 'interface{} -> any' .
Updates #9687
Diffstat (limited to 'markup/highlight')
-rw-r--r--markup/highlight/config.go12
-rw-r--r--markup/highlight/highlight.go8
2 files changed, 10 insertions, 10 deletions
diff --git a/markup/highlight/config.go b/markup/highlight/config.go
index 1142c5e11..08c1bca1a 100644
--- a/markup/highlight/config.go
+++ b/markup/highlight/config.go
@@ -115,12 +115,12 @@ func (cfg Config) ToHTMLOptions() []html.Option {
return options
}
-func applyOptions(opts interface{}, cfg *Config) error {
+func applyOptions(opts any, cfg *Config) error {
if opts == nil {
return nil
}
switch vv := opts.(type) {
- case map[string]interface{}:
+ case map[string]any:
return applyOptionsFromMap(vv, cfg)
default:
s, err := cast.ToStringE(opts)
@@ -139,7 +139,7 @@ func applyOptionsFromString(opts string, cfg *Config) error {
return mapstructure.WeakDecode(optsm, cfg)
}
-func applyOptionsFromMap(optsm map[string]interface{}, cfg *Config) error {
+func applyOptionsFromMap(optsm map[string]any, cfg *Config) error {
normalizeHighlightOptions(optsm)
return mapstructure.WeakDecode(optsm, cfg)
}
@@ -184,9 +184,9 @@ func ApplyLegacyConfig(cfg config.Provider, conf *Config) error {
return nil
}
-func parseHightlightOptions(in string) (map[string]interface{}, error) {
+func parseHightlightOptions(in string) (map[string]any, error) {
in = strings.Trim(in, " ")
- opts := make(map[string]interface{})
+ opts := make(map[string]any)
if in == "" {
return opts, nil
@@ -207,7 +207,7 @@ func parseHightlightOptions(in string) (map[string]interface{}, error) {
return opts, nil
}
-func normalizeHighlightOptions(m map[string]interface{}) {
+func normalizeHighlightOptions(m map[string]any) {
if m == nil {
return
}
diff --git a/markup/highlight/highlight.go b/markup/highlight/highlight.go
index 892cb72ee..8e7f6ee30 100644
--- a/markup/highlight/highlight.go
+++ b/markup/highlight/highlight.go
@@ -58,8 +58,8 @@ func New(cfg Config) Highlighter {
}
type Highlighter interface {
- Highlight(code, lang string, opts interface{}) (string, error)
- HighlightCodeBlock(ctx hooks.CodeblockContext, opts interface{}) (HightlightResult, error)
+ Highlight(code, lang string, opts any) (string, error)
+ HighlightCodeBlock(ctx hooks.CodeblockContext, opts any) (HightlightResult, error)
hooks.CodeBlockRenderer
hooks.IsDefaultCodeBlockRendererProvider
}
@@ -68,7 +68,7 @@ type chromaHighlighter struct {
cfg Config
}
-func (h chromaHighlighter) Highlight(code, lang string, opts interface{}) (string, error) {
+func (h chromaHighlighter) Highlight(code, lang string, opts any) (string, error) {
cfg := h.cfg
if err := applyOptions(opts, &cfg); err != nil {
return "", err
@@ -82,7 +82,7 @@ func (h chromaHighlighter) Highlight(code, lang string, opts interface{}) (strin
return b.String(), nil
}
-func (h chromaHighlighter) HighlightCodeBlock(ctx hooks.CodeblockContext, opts interface{}) (HightlightResult, error) {
+func (h chromaHighlighter) HighlightCodeBlock(ctx hooks.CodeblockContext, opts any) (HightlightResult, error) {
cfg := h.cfg
var b strings.Builder