mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Revise the fix for shortcode vs output format nilpointer
We do lazy initialization and (potentially) reuse of an output format's rendered content. We do this evaluation when we start a new rendering a new output format. There are, however, situation where these borders gets crossed (e.g. accessing content from another output format). We have a check for this in place for most cases, but not the content rendering of inner markdown blocks inside shortcodes. This patch applies that same logic to the newly introduced RenderContent method (which is not available from the templates). Fixes #10391
This commit is contained in:
@@ -381,19 +381,8 @@ func renderShortcode(
|
||||
// Pre Hugo 0.55 this was the behaviour even for the outer-most
|
||||
// shortcode.
|
||||
if sc.doMarkup && (level > 0 || sc.configVersion() == 1) {
|
||||
|
||||
cp := p.pageOutput.cp
|
||||
if cp == nil {
|
||||
var err error
|
||||
cp, err = newPageContentOutput(p, p.pageOutput)
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
p.pageOutput.initContentProvider(cp)
|
||||
}
|
||||
|
||||
var err error
|
||||
b, err := p.pageOutput.cp.renderContent([]byte(inner), false)
|
||||
b, err := p.pageOutput.contentRenderer.RenderContent([]byte(inner), false)
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user