diff options
Diffstat (limited to 'markup/goldmark/convert.go')
-rw-r--r-- | markup/goldmark/convert.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/markup/goldmark/convert.go b/markup/goldmark/convert.go index 6ebcd8a77..56cc56fcd 100644 --- a/markup/goldmark/convert.go +++ b/markup/goldmark/convert.go @@ -19,6 +19,7 @@ import ( "github.com/gohugoio/hugo/identity" + "github.com/gohugoio/hugo-goldmark-extensions/passthrough" "github.com/gohugoio/hugo/markup/goldmark/codeblocks" "github.com/gohugoio/hugo/markup/goldmark/goldmark_config" "github.com/gohugoio/hugo/markup/goldmark/images" @@ -154,6 +155,33 @@ func newMarkdown(pcfg converter.ProviderConfig) goldmark.Markdown { extensions = append(extensions, c) } + 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.NewPassthroughWithDelimiters( + inlineDelimiters, + blockDelimiters, + )) + } + if pcfg.Conf.EnableEmoji() { extensions = append(extensions, emoji.Emoji) } |