mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Add render hooks for inline and block passthrough snippets
Fixes #11927
This commit is contained in:
@@ -18,15 +18,14 @@ import (
|
||||
"bytes"
|
||||
|
||||
"github.com/gohugoio/hugo-goldmark-extensions/extras"
|
||||
"github.com/gohugoio/hugo-goldmark-extensions/passthrough"
|
||||
"github.com/gohugoio/hugo/markup/goldmark/hugocontext"
|
||||
"github.com/yuin/goldmark/util"
|
||||
|
||||
"github.com/gohugoio/hugo/markup/goldmark/codeblocks"
|
||||
"github.com/gohugoio/hugo/markup/goldmark/goldmark_config"
|
||||
"github.com/gohugoio/hugo/markup/goldmark/hugocontext"
|
||||
"github.com/gohugoio/hugo/markup/goldmark/images"
|
||||
"github.com/gohugoio/hugo/markup/goldmark/internal/extensions/attributes"
|
||||
"github.com/gohugoio/hugo/markup/goldmark/internal/render"
|
||||
"github.com/gohugoio/hugo/markup/goldmark/passthrough"
|
||||
"github.com/yuin/goldmark/util"
|
||||
|
||||
"github.com/yuin/goldmark"
|
||||
emoji "github.com/yuin/goldmark-emoji"
|
||||
@@ -177,32 +176,7 @@ func newMarkdown(pcfg converter.ProviderConfig) goldmark.Markdown {
|
||||
}
|
||||
|
||||
if cfg.Extensions.Passthrough.Enable {
|
||||
configuredInlines := cfg.Extensions.Passthrough.Delimiters.Inline
|
||||
configuredBlocks := cfg.Extensions.Passthrough.Delimiters.Block
|
||||
|
||||
inlineDelimiters := make([]passthrough.Delimiters, len(configuredInlines))
|
||||
blockDelimiters := make([]passthrough.Delimiters, len(configuredBlocks))
|
||||
|
||||
for i, d := range configuredInlines {
|
||||
inlineDelimiters[i] = passthrough.Delimiters{
|
||||
Open: d[0],
|
||||
Close: d[1],
|
||||
}
|
||||
}
|
||||
|
||||
for i, d := range configuredBlocks {
|
||||
blockDelimiters[i] = passthrough.Delimiters{
|
||||
Open: d[0],
|
||||
Close: d[1],
|
||||
}
|
||||
}
|
||||
|
||||
extensions = append(extensions, passthrough.New(
|
||||
passthrough.Config{
|
||||
InlineDelimiters: inlineDelimiters,
|
||||
BlockDelimiters: blockDelimiters,
|
||||
},
|
||||
))
|
||||
extensions = append(extensions, passthrough.New(cfg.Extensions.Passthrough))
|
||||
}
|
||||
|
||||
if pcfg.Conf.EnableEmoji() {
|
||||
|
Reference in New Issue
Block a user