]> git.maquefel.me Git - brevno-suite/hugo/commit
Improve and extend .Position handling in Goldmark render hooks
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 25 Mar 2026 17:28:19 +0000 (18:28 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 2 Apr 2026 17:30:28 +0000 (19:30 +0200)
commit303e443ea7ba5c22dc5d2b5df5d7c5392b0dcc3a
tree1ef05f076f4d2247ba2b94b0bf457856b7945706
parentbeb57a68396b902b7ed46a7581e8a02307c7c3cc
Improve and extend .Position handling in Goldmark render hooks

Goldmark v1.8 reports source positions in render hooks.
Use this to build a source map that translates Goldmark positions back to
the original content source.

Now all render hooks' context object implenent the `BaseContext` interface:

```go
type BaseContext interface {
Position() Position
Page() any
PageInner() any
Ordinal() int
}
```

Closes #14663

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
16 files changed:
go.mod
go.sum
hugolib/page__content.go
hugolib/page__per_output.go
hugolib/site.go
markup/converter/hooks/hooks.go
markup/goldmark/blockquotes/blockquotes.go
markup/goldmark/blockquotes/blockquotes_integration_test.go
markup/goldmark/codeblocks/codeblocks_integration_test.go
markup/goldmark/codeblocks/render.go
markup/goldmark/internal/render/context.go
markup/goldmark/passthrough/passthrough.go
markup/goldmark/render_hooks.go
markup/goldmark/tables/tables.go
tpl/tplimpl/render_hook_integration_test.go
tpl/transform/transform_integration_test.go