Documentation
¶
Index ¶
- func ParseParams(raw string) map[string]string
- type Processor
- type Registry
- func (r *Registry) Has(name string) bool
- func (r *Registry) LoadOverridesFromDir(dir string) error
- func (r *Registry) Names() []string
- func (r *Registry) Register(name string, content []byte) error
- func (r *Registry) Resolve(name string) *htmltemplate.Template
- func (r *Registry) TemplateHash() string
- type ShortcodeContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseParams ¶
ParseParams extracts key=value pairs from a raw attribute string.
Types ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
Processor applies shortcode substitution to raw markdown before Goldmark runs.
func NewProcessor ¶
NewProcessor creates a Processor backed by the given registry.
func (*Processor) Process ¶
func (p *Processor) Process( markdown string, page *engine.Page, site *engine.SiteContext, mdRenderer engine.MarkdownRenderer, ) (string, []engine.ValidationWarning)
Process applies all shortcode substitutions to the markdown source. mdRenderer is passed per-call for goroutine safety (caller passes its pool-borrowed renderer).
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages shortcode templates with three-layer override support. Shortcodes are user-defined content components invoked from markdown via {{< name >}} syntax. The registry is immutable after construction and safe for concurrent read access.
func NewRegistry ¶
NewRegistry creates a Registry and loads built-in shortcodes from the embedded FS.
func (*Registry) LoadOverridesFromDir ¶
LoadOverridesFromDir loads shortcode overrides from a filesystem directory. Each .html file overrides the shortcode named after the file (without extension).
func (*Registry) Resolve ¶
func (r *Registry) Resolve(name string) *htmltemplate.Template
Resolve returns the template for a named shortcode, or nil if not registered.
func (*Registry) TemplateHash ¶
TemplateHash returns a sha256 hex digest over all registered template sources, sorted by name. Used for cache invalidation in dev mode.
type ShortcodeContext ¶
type ShortcodeContext struct {
Params map[string]string
Inner htmltemplate.HTML
Page *engine.Page
Site *engine.SiteContext
}
ShortcodeContext is the data object passed to every shortcode template.