diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-04-12 10:15:02 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-04-12 14:41:32 +0200 |
commit | 5596dc24a0adc8907f52886a8e035e1bcd66dd8d (patch) | |
tree | 372bece1601ed69fc92e3925e6183b6a1b9293e2 /markup/markup_config/config.go | |
parent | d01731d53c7c9492cb9666a1223419691a95006c (diff) |
markup/goldmark: Add config options for the typographer extension
Note that the config per language part of this will be handled in #10602.
Updates #9772
Diffstat (limited to 'markup/markup_config/config.go')
-rw-r--r-- | markup/markup_config/config.go | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/markup/markup_config/config.go b/markup/markup_config/config.go index e254ba7a0..60446b9bc 100644 --- a/markup/markup_config/config.go +++ b/markup/markup_config/config.go @@ -62,15 +62,32 @@ func Decode(cfg config.Provider) (conf Config, err error) { func normalizeConfig(m map[string]any) { v, err := maps.GetNestedParam("goldmark.parser", ".", m) - if err != nil { - return + if err == nil { + vm := maps.ToStringMap(v) + // Changed from a bool in 0.81.0 + if vv, found := vm["attribute"]; found { + if vvb, ok := vv.(bool); ok { + vm["attribute"] = goldmark_config.ParserAttribute{ + Title: vvb, + } + } + } } - vm := maps.ToStringMap(v) - // Changed from a bool in 0.81.0 - if vv, found := vm["attribute"]; found { - if vvb, ok := vv.(bool); ok { - vm["attribute"] = goldmark_config.ParserAttribute{ - Title: vvb, + + // Changed from a bool in 0.112.0. + v, err = maps.GetNestedParam("goldmark.extensions", ".", m) + if err == nil { + vm := maps.ToStringMap(v) + const typographerKey = "typographer" + if vv, found := vm[typographerKey]; found { + if vvb, ok := vv.(bool); ok { + if !vvb { + vm[typographerKey] = goldmark_config.Typographer{ + Disable: true, + } + } else { + delete(vm, typographerKey) + } } } } |