diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-02-24 07:23:10 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-02-24 10:40:06 +0100 |
commit | 271318ad787ee2442c6d553edffaa29e1d9a4cf7 (patch) | |
tree | 4314daa1667ecb7badff421a5c19e51f5ea7bc4f /markup/asciidocext | |
parent | e442a63bb7659d95aec2d48bf954cd9d61163559 (diff) |
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
Diffstat (limited to 'markup/asciidocext')
-rw-r--r-- | markup/asciidocext/convert.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/markup/asciidocext/convert.go b/markup/asciidocext/convert.go index c9524778f..c3bd90edd 100644 --- a/markup/asciidocext/convert.go +++ b/markup/asciidocext/convert.go @@ -52,7 +52,7 @@ func (p provider) New(cfg converter.ProviderConfig) (converter.Provider, error) } type asciidocResult struct { - converter.Result + converter.ResultRender toc *tableofcontents.Fragments } @@ -65,7 +65,7 @@ type asciidocConverter struct { cfg converter.ProviderConfig } -func (a *asciidocConverter) Convert(ctx converter.RenderContext) (converter.Result, error) { +func (a *asciidocConverter) Convert(ctx converter.RenderContext) (converter.ResultRender, error) { b, err := a.getAsciidocContent(ctx.Src, a.ctx) if err != nil { return nil, err @@ -75,8 +75,8 @@ func (a *asciidocConverter) Convert(ctx converter.RenderContext) (converter.Resu return nil, err } return asciidocResult{ - Result: converter.Bytes(content), - toc: toc, + ResultRender: converter.Bytes(content), + toc: toc, }, nil } |