aboutsummaryrefslogtreecommitdiffhomepage
path: root/markup/goldmark/codeblocks/render.go
diff options
context:
space:
mode:
Diffstat (limited to 'markup/goldmark/codeblocks/render.go')
-rw-r--r--markup/goldmark/codeblocks/render.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/markup/goldmark/codeblocks/render.go b/markup/goldmark/codeblocks/render.go
index 51f3b20f8..fad3ac458 100644
--- a/markup/goldmark/codeblocks/render.go
+++ b/markup/goldmark/codeblocks/render.go
@@ -147,6 +147,8 @@ func (r *htmlRenderer) getPageInner(rctx *render.Context) any {
return rctx.DocumentContext().Document
}
+var _ hooks.PositionerSourceTargetProvider = (*codeBlockContext)(nil)
+
type codeBlockContext struct {
page any
pageInner any
@@ -190,6 +192,11 @@ func (c *codeBlockContext) Position() htext.Position {
return c.pos
}
+// For internal use.
+func (c *codeBlockContext) PositionerSourceTarget() []byte {
+ return []byte(c.code)
+}
+
func getLang(node *ast.FencedCodeBlock, src []byte) string {
langWithAttributes := string(node.Language(src))
lang, _, _ := strings.Cut(langWithAttributes, "{")