aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-08-05 16:51:16 +0200
committerBjørn Erik Pedersen <[email protected]>2024-08-07 18:28:23 +0200
commit665ac949bdc2e54d378ef5c00778c830440a1a9d (patch)
tree3423b71315155a8d855bb806293470824a78ff19 /hugolib
parent4c162deb036a1f65769c12e6078ac79b70f5901b (diff)
downloadhugo-665ac949bdc2e54d378ef5c00778c830440a1a9d.tar.gz
hugo-665ac949bdc2e54d378ef5c00778c830440a1a9d.zip
markup: Add blockquote render hooks
Closes #12590
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/page__per_output.go9
-rw-r--r--hugolib/site.go4
2 files changed, 11 insertions, 2 deletions
diff --git a/hugolib/page__per_output.go b/hugolib/page__per_output.go
index 59ba722a8..59cb574df 100644
--- a/hugolib/page__per_output.go
+++ b/hugolib/page__per_output.go
@@ -440,8 +440,8 @@ func (pco *pageContentOutput) initRenderHooks() error {
var offset int
switch v := ctx.(type) {
- case hooks.CodeblockContext:
- offset = bytes.Index(source, []byte(v.Inner()))
+ case hooks.PositionerSourceTargetProvider:
+ offset = bytes.Index(source, v.PositionerSourceTarget())
}
pos := pco.po.p.posFromInput(source, offset)
@@ -481,6 +481,11 @@ func (pco *pageContentOutput) initRenderHooks() error {
if id != nil {
layoutDescriptor.KindVariants = id.(string)
}
+ case hooks.BlockquoteRendererType:
+ layoutDescriptor.Kind = "render-blockquote"
+ if id != nil {
+ layoutDescriptor.KindVariants = id.(string)
+ }
case hooks.CodeBlockRendererType:
layoutDescriptor.Kind = "render-codeblock"
if id != nil {
diff --git a/hugolib/site.go b/hugolib/site.go
index 0b089767a..bbf110d1d 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -919,6 +919,10 @@ func (hr hookRendererTemplate) RenderPassthrough(cctx context.Context, w io.Writ
return hr.templateHandler.ExecuteWithContext(cctx, hr.templ, w, ctx)
}
+func (hr hookRendererTemplate) RenderBlockquote(cctx context.Context, w hugio.FlexiWriter, ctx hooks.BlockquoteContext) error {
+ return hr.templateHandler.ExecuteWithContext(cctx, hr.templ, w, ctx)
+}
+
func (hr hookRendererTemplate) ResolvePosition(ctx any) text.Position {
return hr.resolvePosition(ctx)
}