diff options
Diffstat (limited to 'hugolib/page__per_output.go')
-rw-r--r-- | hugolib/page__per_output.go | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/hugolib/page__per_output.go b/hugolib/page__per_output.go index 4ff67c074..5b039b91b 100644 --- a/hugolib/page__per_output.go +++ b/hugolib/page__per_output.go @@ -25,6 +25,8 @@ import ( "github.com/gohugoio/hugo/common/text" "github.com/gohugoio/hugo/common/types/hstring" "github.com/gohugoio/hugo/identity" + "github.com/gohugoio/hugo/markup" + "github.com/gohugoio/hugo/media" "github.com/gohugoio/hugo/parser/pageparser" "github.com/mitchellh/mapstructure" "github.com/spf13/cast" @@ -89,8 +91,8 @@ type pageContentOutput struct { // typically included with .RenderShortcodes. otherOutputs map[uint64]*pageContentOutput - contentRenderedVersion int // Incremented on reset. - contentRendered bool // Set on content render. + contentRenderedVersion uint32 // Incremented on reset. + contentRendered bool // Set on content render. // Renders Markdown hooks. renderHooks *renderHooks @@ -175,7 +177,7 @@ func (pco *pageContentOutput) RenderShortcodes(ctx context.Context) (template.HT // This content will be parsed and rendered by Goldmark. // Wrap it in a special Hugo markup to assign the correct Page from // the stack. - c = hugocontext.Wrap(c, pco.po.p.pid) + return template.HTML(hugocontext.Wrap(c, pco.po.p.pid)), nil } return helpers.BytesToHTML(c), nil @@ -262,6 +264,9 @@ func (pco *pageContentOutput) RenderString(ctx context.Context, args ...any) (te if err := mapstructure.WeakDecode(m, &opts); err != nil { return "", fmt.Errorf("failed to decode options: %w", err) } + if opts.Markup != "" { + opts.Markup = markup.ResolveMarkup(opts.Markup) + } } contentToRenderv := args[sidx] @@ -283,7 +288,8 @@ func (pco *pageContentOutput) RenderString(ctx context.Context, args ...any) (te } conv := pco.po.p.getContentConverter() - if opts.Markup != "" && opts.Markup != pco.po.p.m.pageConfig.Markup { + + if opts.Markup != "" && opts.Markup != pco.po.p.m.pageConfig.ContentMediaType.SubType { var err error conv, err = pco.po.p.m.newContentConverter(pco.po.p, opts.Markup) if err != nil { @@ -376,7 +382,7 @@ func (pco *pageContentOutput) RenderString(ctx context.Context, args ...any) (te } if opts.Display == "inline" { - markup := pco.po.p.m.pageConfig.Markup + markup := pco.po.p.m.pageConfig.Content.Markup if opts.Markup != "" { markup = pco.po.p.s.ContentSpec.ResolveMarkup(opts.Markup) } @@ -657,7 +663,7 @@ func splitUserDefinedSummaryAndContent(markup string, c []byte) (summary []byte, startTag := "p" switch markup { - case "asciidocext": + case media.DefaultContentTypes.AsciiDoc.SubType: startTag = "div" } |