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