markup: Add blockquote render hooks

Closes #12590
This commit is contained in:
Bjørn Erik Pedersen
2024-08-05 16:51:16 +02:00
parent 4c162deb03
commit 665ac949bd
9 changed files with 453 additions and 2 deletions

View File

@@ -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, "{")