mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
Split parse and render for Goldmark
This also speeds up situations where you only need the fragments/toc and not the rendered content, e.g. Related with fragments type indexing: ```bash name old time/op new time/op delta RelatedSite-10 12.3ms ± 2% 10.7ms ± 1% -12.95% (p=0.029 n=4+4) name old alloc/op new alloc/op delta RelatedSite-10 38.6MB ± 0% 38.2MB ± 0% -1.08% (p=0.029 n=4+4) name old allocs/op new allocs/op delta RelatedSite-10 117k ± 0% 115k ± 0% -1.36% (p=0.029 n=4+4) ``` Fixes #10750
This commit is contained in:
@@ -133,7 +133,16 @@ func (lcp *LazyContentProvider) TableOfContents(ctx context.Context) template.HT
|
||||
return lcp.cp.TableOfContents(ctx)
|
||||
}
|
||||
|
||||
func (lcp *LazyContentProvider) RenderContent(ctx context.Context, content []byte, renderTOC bool) (converter.Result, error) {
|
||||
func (lcp *LazyContentProvider) ParseAndRenderContent(ctx context.Context, content []byte, renderTOC bool) (converter.ResultRender, error) {
|
||||
lcp.init.Do(ctx)
|
||||
return lcp.cp.RenderContent(ctx, content, renderTOC)
|
||||
return lcp.cp.ParseAndRenderContent(ctx, content, renderTOC)
|
||||
}
|
||||
|
||||
func (lcp *LazyContentProvider) ParseContent(ctx context.Context, content []byte) (converter.ResultParse, bool, error) {
|
||||
lcp.init.Do(ctx)
|
||||
return lcp.cp.ParseContent(ctx, content)
|
||||
}
|
||||
func (lcp *LazyContentProvider) RenderContent(ctx context.Context, content []byte, doc any) (converter.ResultRender, bool, error) {
|
||||
lcp.init.Do(ctx)
|
||||
return lcp.cp.RenderContent(ctx, content, doc)
|
||||
}
|
||||
|
Reference in New Issue
Block a user