mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
markup/goldmark: Add Position to CodeblockContext
But note that this is not particulary fast and the recommendad usage is error logging only. Updates #9574
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/gohugoio/hugo/common/hugio"
|
||||
"github.com/gohugoio/hugo/common/text"
|
||||
"github.com/gohugoio/hugo/identity"
|
||||
"github.com/gohugoio/hugo/markup/internal/attributes"
|
||||
)
|
||||
@@ -37,6 +38,7 @@ type LinkContext interface {
|
||||
|
||||
type CodeblockContext interface {
|
||||
AttributesProvider
|
||||
text.Positioner
|
||||
Options() map[string]interface{}
|
||||
Lang() string
|
||||
Code() string
|
||||
@@ -59,6 +61,10 @@ type CodeBlockRenderer interface {
|
||||
identity.Provider
|
||||
}
|
||||
|
||||
type IsDefaultCodeBlockRendererProvider interface {
|
||||
IsDefaultCodeBlockRenderer() bool
|
||||
}
|
||||
|
||||
// HeadingContext contains accessors to all attributes that a HeadingRenderer
|
||||
// can use to render a heading.
|
||||
type HeadingContext interface {
|
||||
@@ -84,6 +90,14 @@ type HeadingRenderer interface {
|
||||
identity.Provider
|
||||
}
|
||||
|
||||
// ElementPositionRevolver provides a way to resolve the start Position
|
||||
// of a markdown element in the original source document.
|
||||
// This may be both slow and aproximate, so should only be
|
||||
// used for error logging.
|
||||
type ElementPositionRevolver interface {
|
||||
ResolvePosition(ctx interface{}) text.Position
|
||||
}
|
||||
|
||||
type RendererType int
|
||||
|
||||
const (
|
||||
|
Reference in New Issue
Block a user