Documentation
¶
Overview ¶
Package shortcode provides Hugo-compatible shortcode registration and expansion.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AudioHandler ¶
AudioHandler implements the {{< audio src="..." title="..." >}} shortcode. Mirrors themes/zozo/layouts/shortcodes/audio.html.
func ImgHandler ¶
ImgHandler implements the {{< img src="..." title="..." >}} shortcode. Mirrors themes/zozo/layouts/shortcodes/img.html.
Types ¶
type Context ¶
type Context struct {
Params map[string]string
Inner string // content between {{< x >}}...{{< /x >}}
Args []string
Page *content.Page
Site *content.Site
}
Context is what a shortcode handler receives.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds all registered shortcode handlers.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a new shortcode registry with built-in shortcodes registered.
func (*Registry) Expand ¶
Expand processes all shortcodes in the given markdown body. It handles both inline (self-closing) and block (with inner content) forms. Unknown shortcodes are left in place untouched.