mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-16 20:53:59 +02:00
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
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user