Documentation
¶
Index ¶
- func BuildKazariEngine(ctx context.Context, cfg *config.CodeblocksSettings, projectDir string) (*kazari.Engine, error)
- func ImageLookupForPage(page *engine.Page, processor *asset.ImageProcessor) imagerender.ImageLookupFunc
- func LazyLoadingEnabled(processor *asset.ImageProcessor) bool
- type Renderer
- func (r *Renderer) Fingerprint() string
- func (r *Renderer) LinkRenderer() *linkrender.Renderer
- func (r *Renderer) Render(markdown string) (engine.RenderResult, error)
- func (r *Renderer) ResetFlags()
- func (r *Renderer) SetImageLazyLoading(enabled bool)
- func (r *Renderer) SetImageLookup(lookup imagerender.ImageLookupFunc)
- func (r *Renderer) SetLinkContext(page *engine.Page)
- type RendererConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildKazariEngine ¶
func BuildKazariEngine(ctx context.Context, cfg *config.CodeblocksSettings, projectDir string) (*kazari.Engine, error)
BuildKazariEngine creates a Kazari code block engine. The highlighter backend is selected by cfg.Engine: "chroma" for fast Go-native highlighting (ideal for dev/live-reload), "nuri" (default) for accurate TextMate-based highlighting matching VS Code output.
func ImageLookupForPage ¶
func ImageLookupForPage(page *engine.Page, processor *asset.ImageProcessor) imagerender.ImageLookupFunc
ImageLookupForPage creates a lookup function for a specific page's resources.
func LazyLoadingEnabled ¶ added in v1.2.0
func LazyLoadingEnabled(processor *asset.ImageProcessor) bool
LazyLoadingEnabled reports the processor's site-wide lazy-loading setting (default true when unset or when there is no processor).
Types ¶
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer handles markdown to HTML conversion with heading extraction. Implements engine.MarkdownRenderer.
func NewRenderer ¶
func NewRenderer() *Renderer
NewRenderer creates a markdown renderer with all extensions and default security.
func NewRendererFromConfig ¶
func NewRendererFromConfig(cfg RendererConfig) *Renderer
NewRendererFromConfig creates a markdown renderer from a full configuration.
func NewRendererWithConfig ¶
NewRendererWithConfig creates a markdown renderer with the provided blocked href schemes. Deprecated: use NewRendererFromConfig for full configuration.
func (*Renderer) Fingerprint ¶
Fingerprint returns a content-addressed digest of the renderer's identity: registered extension types, config values, and Kazari CSS. The builder includes this in the page-cache key so the cache auto-invalidates when the rendering pipeline changes.
func (*Renderer) LinkRenderer ¶
func (r *Renderer) LinkRenderer() *linkrender.Renderer
LinkRenderer returns the internal link renderer for external configuration (setting PageIndex, URLResolver, Policy).
func (*Renderer) Render ¶
func (r *Renderer) Render(markdown string) (engine.RenderResult, error)
Render converts markdown to HTML, extracts headings, and returns both. Implements engine.MarkdownRenderer.
func (*Renderer) ResetFlags ¶
func (r *Renderer) ResetFlags()
ResetFlags zeroes content feature flags before each page render.
func (*Renderer) SetImageLazyLoading ¶ added in v1.2.0
SetImageLazyLoading propagates the site-wide lazy-loading setting to the image renderer so the plain-<img> fallback path honors it too (the first image per page always loads eagerly regardless).
func (*Renderer) SetImageLookup ¶
func (r *Renderer) SetImageLookup(lookup imagerender.ImageLookupFunc)
SetImageLookup sets the lookup function for bundle-relative image processing. Swaps the lookup on the existing image renderer without rebuilding the Goldmark instance.
func (*Renderer) SetLinkContext ¶
SetLinkContext sets the current page for internal link resolution. Must be called before Render() for each page.
type RendererConfig ¶
type RendererConfig struct {
BlockedHrefSchemes []string
HeadingLinks bool
HeadingMinLevel int
HeadingMaxLevel int
// HardWraps renders a single newline inside a paragraph as <br>. Off by
// default, matching CommonMark, so prose wrapped in the source reflows.
HardWraps bool
// AsideStyle selects the aside icon set ("classic" or "galaxy").
// Empty behaves as classic.
AsideStyle string
KazariEngine *kazari.Engine
// DirectiveRegistry holds site/theme generic directives. Nil or empty
// no-ops the generic directive extension.
DirectiveRegistry *directive.Registry
}
RendererConfig controls markdown renderer behavior.
Directories
¶
| Path | Synopsis |
|---|---|
|
extensions
|
|
|
blockutil
Package blockutil provides shared helpers for container-style block directive parsers.
|
Package blockutil provides shared helpers for container-style block directive parsers. |
|
codediff
Package codediff is a stub extension for organizational completeness.
|
Package codediff is a stub extension for organizational completeness. |
|
genericdirective
Package genericdirective is the goldmark side of site- and theme-authored generic directives (internal/directive): one block parser and renderer handle every registered ::: directive, dispatching on the fence name.
|
Package genericdirective is the goldmark side of site- and theme-authored generic directives (internal/directive): one block parser and renderer handle every registered ::: directive, dispatching on the fence name. |