aboutsummaryrefslogtreecommitdiffhomepage
path: root/markup/goldmark/convert.go
diff options
context:
space:
mode:
Diffstat (limited to 'markup/goldmark/convert.go')
-rw-r--r--markup/goldmark/convert.go28
1 files changed, 1 insertions, 27 deletions
diff --git a/markup/goldmark/convert.go b/markup/goldmark/convert.go
index 56cc56fcd..de06bedff 100644
--- a/markup/goldmark/convert.go
+++ b/markup/goldmark/convert.go
@@ -17,8 +17,6 @@ package goldmark
import (
"bytes"
- "github.com/gohugoio/hugo/identity"
-
"github.com/gohugoio/hugo-goldmark-extensions/passthrough"
"github.com/gohugoio/hugo/markup/goldmark/codeblocks"
"github.com/gohugoio/hugo/markup/goldmark/goldmark_config"
@@ -213,8 +211,6 @@ func newMarkdown(pcfg converter.ProviderConfig) goldmark.Markdown {
return md
}
-var _ identity.IdentitiesProvider = (*converterResult)(nil)
-
type parserResult struct {
doc any
toc *tableofcontents.Fragments
@@ -230,25 +226,17 @@ func (p parserResult) TableOfContents() *tableofcontents.Fragments {
type renderResult struct {
converter.ResultRender
- ids identity.Identities
-}
-
-func (r renderResult) GetIdentities() identity.Identities {
- return r.ids
}
type converterResult struct {
converter.ResultRender
tableOfContentsProvider
- identity.IdentitiesProvider
}
type tableOfContentsProvider interface {
TableOfContents() *tableofcontents.Fragments
}
-var converterIdentity = identity.KeyValueIdentity{Key: "goldmark", Value: "converter"}
-
func (c *goldmarkConverter) Parse(ctx converter.RenderContext) (converter.ResultParse, error) {
pctx := c.newParserContext(ctx)
reader := text.NewReader(ctx.Src)
@@ -262,8 +250,8 @@ func (c *goldmarkConverter) Parse(ctx converter.RenderContext) (converter.Result
doc: doc,
toc: pctx.TableOfContents(),
}, nil
-
}
+
func (c *goldmarkConverter) Render(ctx converter.RenderContext, doc any) (converter.ResultRender, error) {
n := doc.(ast.Node)
buf := &render.BufWriter{Buffer: &bytes.Buffer{}}
@@ -271,7 +259,6 @@ func (c *goldmarkConverter) Render(ctx converter.RenderContext, doc any) (conver
rcx := &render.RenderContextDataHolder{
Rctx: ctx,
Dctx: c.ctx,
- IDs: identity.NewManager(converterIdentity),
}
w := &render.Context{
@@ -285,9 +272,7 @@ func (c *goldmarkConverter) Render(ctx converter.RenderContext, doc any) (conver
return renderResult{
ResultRender: buf,
- ids: rcx.IDs.GetIdentities(),
}, nil
-
}
func (c *goldmarkConverter) Convert(ctx converter.RenderContext) (converter.ResultRender, error) {
@@ -302,17 +287,7 @@ func (c *goldmarkConverter) Convert(ctx converter.RenderContext) (converter.Resu
return converterResult{
ResultRender: renderResult,
tableOfContentsProvider: parseResult,
- IdentitiesProvider: renderResult.(identity.IdentitiesProvider),
}, nil
-
-}
-
-var featureSet = map[identity.Identity]bool{
- converter.FeatureRenderHooks: true,
-}
-
-func (c *goldmarkConverter) Supports(feature identity.Identity) bool {
- return featureSet[feature.GetIdentity()]
}
func (c *goldmarkConverter) newParserContext(rctx converter.RenderContext) *parserContext {
@@ -349,5 +324,4 @@ func toTypographicPunctuationMap(t goldmark_config.Typographer) map[extension.Ty
extension.RightAngleQuote: []byte(t.RightAngleQuote),
extension.Apostrophe: []byte(t.Apostrophe),
}
-
}