mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
@@ -78,6 +78,33 @@ type CodeblockContext interface {
|
||||
Ordinal() int
|
||||
}
|
||||
|
||||
// BlockquoteContext is the context passed to a blockquote render hook.
|
||||
type BlockquoteContext interface {
|
||||
AttributesProvider
|
||||
text.Positioner
|
||||
PageProvider
|
||||
|
||||
// Zero-based ordinal for all block quotes in the current document.
|
||||
Ordinal() int
|
||||
|
||||
// The blockquote text.
|
||||
// If type is "alert", this will be the alert text.
|
||||
Text() hstring.RenderedString
|
||||
|
||||
/// Returns the blockquote type, one of "regular" and "alert".
|
||||
// Type "alert" indicates that this is a GitHub type alert.
|
||||
Type() string
|
||||
|
||||
// The GitHub alert type converted to lowercase, e.g. "note".
|
||||
// Only set if Type is "alert".
|
||||
AlertType() string
|
||||
}
|
||||
|
||||
type PositionerSourceTargetProvider interface {
|
||||
// For internal use.
|
||||
PositionerSourceTarget() []byte
|
||||
}
|
||||
|
||||
// PassThroughContext is the context passed to a passthrough render hook.
|
||||
type PassthroughContext interface {
|
||||
AttributesProvider
|
||||
@@ -87,6 +114,9 @@ type PassthroughContext interface {
|
||||
// Currently one of "inline" or "block".
|
||||
Type() string
|
||||
|
||||
// The inner content of the passthrough element, excluding the delimiters.
|
||||
Inner() string
|
||||
|
||||
// Zero-based ordinal for all passthrough elements in the document.
|
||||
Ordinal() int
|
||||
}
|
||||
@@ -104,6 +134,10 @@ type CodeBlockRenderer interface {
|
||||
RenderCodeblock(cctx context.Context, w hugio.FlexiWriter, ctx CodeblockContext) error
|
||||
}
|
||||
|
||||
type BlockquoteRenderer interface {
|
||||
RenderBlockquote(cctx context.Context, w hugio.FlexiWriter, ctx BlockquoteContext) error
|
||||
}
|
||||
|
||||
type PassthroughRenderer interface {
|
||||
RenderPassthrough(cctx context.Context, w io.Writer, ctx PassthroughContext) error
|
||||
}
|
||||
@@ -161,6 +195,7 @@ const (
|
||||
HeadingRendererType
|
||||
CodeBlockRendererType
|
||||
PassthroughRendererType
|
||||
BlockquoteRendererType
|
||||
)
|
||||
|
||||
type GetRendererFunc func(t RendererType, id any) any
|
||||
|
Reference in New Issue
Block a user