summaryrefslogtreecommitdiffstats
path: root/markup/goldmark/convert.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/goldmark/convert.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/goldmark/convert.go')
-rw-r--r--markup/goldmark/convert.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/markup/goldmark/convert.go b/markup/goldmark/convert.go
index 50e7bcb8a..629e2b15a 100644
--- a/markup/goldmark/convert.go
+++ b/markup/goldmark/convert.go
@@ -21,6 +21,8 @@ import (
"path/filepath"
"runtime/debug"
+ "github.com/gohugoio/hugo/markup/goldmark/internal/extensions/attributes"
+
"github.com/gohugoio/hugo/identity"
"github.com/pkg/errors"
@@ -137,10 +139,14 @@ func newMarkdown(pcfg converter.ProviderConfig) goldmark.Markdown {
parserOptions = append(parserOptions, parser.WithAutoHeadingID())
}
- if cfg.Parser.Attribute {
+ if cfg.Parser.Attribute.Title {
parserOptions = append(parserOptions, parser.WithAttribute())
}
+ if cfg.Parser.Attribute.Block {
+ extensions = append(extensions, attributes.New())
+ }
+
md := goldmark.New(
goldmark.WithExtensions(
extensions...,