Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForPage ¶
func ForPage(lookup ImageLookupFunc) util.PrioritizedValue
ForPage creates a NodeRendererFunc priority pair for use in goldmark options. Priority 50 overrides the default image renderer (priority 1000).
Types ¶
type Extension ¶
type Extension struct {
Lookup ImageLookupFunc // legacy: creates a new Renderer with this lookup
Renderer *Renderer // preferred: reuse an existing Renderer (lookup swappable at runtime)
}
Extension registers the custom image renderer with Goldmark.
type ImageLookupFunc ¶
type ImageLookupFunc func(imageName string, opts asset.ImageOptions) *asset.ProcessedImage
ImageLookupFunc looks up processed image data for a page's bundle-relative image. opts carries per-image overrides parsed from Goldmark attributes.
type Renderer ¶
type Renderer struct {
html.Config
Lookup ImageLookupFunc
HasImages bool // set true when at least one image is rendered
LazyLoading bool // site config; the first image per page is always eager
// contains filtered or unexported fields
}
Renderer replaces the default Goldmark image renderer for bundle-relative images. External/absolute URLs pass through with standard <img> rendering. The Lookup field can be swapped at runtime without rebuilding the Goldmark instance.
func NewRenderer ¶
func NewRenderer(lookup ImageLookupFunc) *Renderer
NewRenderer creates a Goldmark image node renderer. If lookup is nil, all images render as standard <img> tags. The Lookup can be changed later via direct field assignment.
func (*Renderer) RegisterFuncs ¶
func (r *Renderer) RegisterFuncs(reg gmrenderer.NodeRendererFuncRegisterer)
RegisterFuncs registers the renderer for ast.KindImage.