summaryrefslogtreecommitdiffstats
path: root/markup/markup_config/config.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-02-07 18:08:46 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-02-08 19:52:55 +0100
commit2681633db8d340d2dc59cf801419874d572fc704 (patch)
tree74451c9bc4249a387aacf8071127d880cfea07db /markup/markup_config/config.go
parent1b2472825664763c0b88807b0d193e73553423ec (diff)
markup/goldmark: Add attributes support for blocks (tables etc.)
E.g.: ``` > foo > bar {.myclass} ``` There are some current limitations: For tables you can currently only apply it to the full table, and for lists the ul/ol-nodes only, e.g.: ``` * Fruit * Apple * Orange * Banana {.fruits} * Dairy * Milk * Cheese {.dairies} {.list} ``` Fixes #7548
Diffstat (limited to 'markup/markup_config/config.go')
-rw-r--r--markup/markup_config/config.go13
1 files changed, 13 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.