summaryrefslogtreecommitdiffstats
path: root/markup/markup_config
diff options
context:
space:
mode:
Diffstat (limited to 'markup/markup_config')
-rw-r--r--markup/markup_config/config.go13
-rw-r--r--markup/markup_config/config_test.go13
2 files changed, 26 insertions, 0 deletions
diff --git a/markup/markup_config/config.go b/markup/markup_config/config.go
index 376350c95..725e04b84 100644
--- a/markup/markup_config/config.go
+++ b/markup/markup_config/config.go
@@ -44,6 +44,8 @@ type Config struct {
func Decode(cfg config.Provider) (conf Config, err error) {
conf = Default
+ normalizeConfig(cfg)
+
m := cfg.GetStringMap("markup")
if m == nil {
return
@@ -65,6 +67,17 @@ func Decode(cfg config.Provider) (conf Config, err error) {
return
}
+func normalizeConfig(cfg config.Provider) {
+ // Changed from a bool in 0.81.0
+ const attrKey = "markup.goldmark.parser.attribute"
+ av := cfg.Get(attrKey)
+ if avb, ok := av.(bool); ok {
+ cfg.Set(attrKey, goldmark_config.ParserAttribute{
+ Title: avb,
+ })
+ }
+}
+
func applyLegacyConfig(cfg config.Provider, conf *Config) error {
if bm := cfg.GetStringMap("blackfriday"); bm != nil {
// Legacy top level blackfriday config.
diff --git a/markup/markup_config/config_test.go b/markup/markup_config/config_test.go
index 89da62bab..4a1f1232b 100644
--- a/markup/markup_config/config_test.go
+++ b/markup/markup_config/config_test.go
@@ -46,6 +46,8 @@ func TestConfig(t *testing.T) {
c.Assert(err, qt.IsNil)
c.Assert(conf.Goldmark.Renderer.Unsafe, qt.Equals, true)
c.Assert(conf.BlackFriday.Fractions, qt.Equals, true)
+ c.Assert(conf.Goldmark.Parser.Attribute.Title, qt.Equals, true)
+ c.Assert(conf.Goldmark.Parser.Attribute.Block, qt.Equals, false)
c.Assert(conf.AsciidocExt.WorkingFolderCurrent, qt.Equals, true)
c.Assert(conf.AsciidocExt.Extensions[0], qt.Equals, "asciidoctor-html5s")
@@ -63,6 +65,14 @@ func TestConfig(t *testing.T) {
v.Set("footnoteReturnLinkContents", "myreturn")
v.Set("pygmentsStyle", "hugo")
v.Set("pygmentsCodefencesGuessSyntax", true)
+
+ v.Set("markup", map[string]interface{}{
+ "goldmark": map[string]interface{}{
+ "parser": map[string]interface{}{
+ "attribute": false, // Was changed to a struct in 0.81.0
+ },
+ },
+ })
conf, err := Decode(v)
c.Assert(err, qt.IsNil)
@@ -72,5 +82,8 @@ func TestConfig(t *testing.T) {
c.Assert(conf.Highlight.Style, qt.Equals, "hugo")
c.Assert(conf.Highlight.CodeFences, qt.Equals, true)
c.Assert(conf.Highlight.GuessSyntax, qt.Equals, true)
+ c.Assert(conf.Goldmark.Parser.Attribute.Title, qt.Equals, false)
+ c.Assert(conf.Goldmark.Parser.Attribute.Block, qt.Equals, false)
+
})
}