aboutsummaryrefslogtreecommitdiffhomepage
path: root/markup/goldmark/internal/render/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'markup/goldmark/internal/render/context.go')
-rw-r--r--markup/goldmark/internal/render/context.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/markup/goldmark/internal/render/context.go b/markup/goldmark/internal/render/context.go
index 306d26748..712e1f053 100644
--- a/markup/goldmark/internal/render/context.go
+++ b/markup/goldmark/internal/render/context.go
@@ -18,6 +18,7 @@ import (
"math/bits"
"github.com/gohugoio/hugo/markup/converter"
+ "github.com/yuin/goldmark/ast"
)
type BufWriter struct {
@@ -40,9 +41,19 @@ func (b *BufWriter) Flush() error {
type Context struct {
*BufWriter
+ ContextData
positions []int
pids []uint64
- ContextData
+ ordinals map[ast.NodeKind]int
+}
+
+func (ctx *Context) GetAndIncrementOrdinal(kind ast.NodeKind) int {
+ if ctx.ordinals == nil {
+ ctx.ordinals = make(map[ast.NodeKind]int)
+ }
+ i := ctx.ordinals[kind]
+ ctx.ordinals[kind]++
+ return i
}
func (ctx *Context) PushPos(n int) {