diff options
Diffstat (limited to 'markup/goldmark/convert.go')
-rw-r--r-- | markup/goldmark/convert.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/markup/goldmark/convert.go b/markup/goldmark/convert.go index dcaf8d3e1..c547fe1e0 100644 --- a/markup/goldmark/convert.go +++ b/markup/goldmark/convert.go @@ -47,8 +47,7 @@ import ( // Provider is the package entry point. var Provider converter.ProviderProvider = provide{} -type provide struct { -} +type provide struct{} func (p provide) New(cfg converter.ProviderConfig) (converter.Provider, error) { md := newMarkdown(cfg) @@ -199,10 +198,21 @@ func (b *bufWriter) Flush() error { type renderContext struct { *bufWriter - pos int + positions []int renderContextData } +func (ctx *renderContext) pushPos(n int) { + ctx.positions = append(ctx.positions, n) +} + +func (ctx *renderContext) popPos() int { + i := len(ctx.positions) - 1 + p := ctx.positions[i] + ctx.positions = ctx.positions[:i] + return p +} + type renderContextData interface { RenderContext() converter.RenderContext DocumentContext() converter.DocumentContext |